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

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

?? zero.c

?? h內核
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* * zero.c -- Gadget Zero, for USB development * * Copyright (C) 2003-2004 David Brownell * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions, and the following disclaimer, *    without modification. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. The names of the above-listed copyright holders may not be used *    to endorse or promote products derived from this software without *    specific prior written permission. * * ALTERNATIVELY, this software may be distributed under the terms of the * GNU General Public License ("GPL") as published by the Free Software * Foundation, either version 2 of that License or (at your option) any * later version. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *//* * Gadget Zero only needs two bulk endpoints, and is an example of how you * can write a hardware-agnostic gadget driver running inside a USB device. * * Hardware details are visible (see CONFIG_USB_ZERO_* below) but don't * affect most of the driver. * * Use it with the Linux host/master side "usbtest" driver to get a basic * functional test of your device-side usb stack, or with "usb-skeleton". * * It supports two similar configurations.  One sinks whatever the usb host * writes, and in return sources zeroes.  The other loops whatever the host * writes back, so the host can read it.  Module options include: * *   buflen=N		default N=4096, buffer size used *   qlen=N		default N=32, how many buffers in the loopback queue *   loopdefault	default false, list loopback config first * * Many drivers will only have one configuration, letting them be much * simpler if they also don't support high speed operation (like this * driver does). */#define DEBUG 1// #define VERBOSE#include <linux/config.h>#include <linux/module.h>#include <linux/kernel.h>#include <linux/delay.h>#include <linux/ioport.h>#include <linux/sched.h>#include <linux/slab.h>#include <linux/smp_lock.h>#include <linux/errno.h>#include <linux/init.h>#include <linux/timer.h>#include <linux/list.h>#include <linux/interrupt.h>#include <linux/utsname.h>#include <linux/device.h>#include <linux/moduleparam.h>#include <asm/byteorder.h>#include <asm/io.h>#include <asm/irq.h>#include <asm/system.h>#include <asm/unaligned.h>#include <linux/usb_ch9.h>#include <linux/usb_gadget.h>#include "gadget_chips.h"/*-------------------------------------------------------------------------*/#define DRIVER_VERSION		"St Patrick's Day 2004"static const char shortname [] = "zero";static const char longname [] = "Gadget Zero";static const char source_sink [] = "source and sink data";static const char loopback [] = "loop input to output";/*-------------------------------------------------------------------------*//* * driver assumes self-powered hardware, and * has no way for users to trigger remote wakeup. * * this version autoconfigures as much as possible, * which is reasonable for most "bulk-only" drivers. */static const char *EP_IN_NAME;		/* source */static const char *EP_OUT_NAME;		/* sink *//*-------------------------------------------------------------------------*//* big enough to hold our biggest descriptor */#define USB_BUFSIZ	256struct zero_dev {	spinlock_t		lock;	struct usb_gadget	*gadget;	struct usb_request	*req;		/* for control responses */	/* when configured, we have one of two configs:	 * - source data (in to host) and sink it (out from host)	 * - or loop it back (out from host back in to host)	 */	u8			config;	struct usb_ep		*in_ep, *out_ep;	/* autoresume timer */	struct timer_list	resume;};#define xprintk(d,level,fmt,args...) \	dev_printk(level , &(d)->gadget->dev , fmt , ## args)#ifdef DEBUG#define DBG(dev,fmt,args...) \	xprintk(dev , KERN_DEBUG , fmt , ## args)#else#define DBG(dev,fmt,args...) \	do { } while (0)#endif /* DEBUG */#ifdef VERBOSE#define VDBG	DBG#else#define VDBG(dev,fmt,args...) \	do { } while (0)#endif /* VERBOSE */#define ERROR(dev,fmt,args...) \	xprintk(dev , KERN_ERR , fmt , ## args)#define WARN(dev,fmt,args...) \	xprintk(dev , KERN_WARNING , fmt , ## args)#define INFO(dev,fmt,args...) \	xprintk(dev , KERN_INFO , fmt , ## args)/*-------------------------------------------------------------------------*/static unsigned buflen = 4096;static unsigned qlen = 32;static unsigned pattern = 0;module_param (buflen, uint, S_IRUGO|S_IWUSR);module_param (qlen, uint, S_IRUGO|S_IWUSR);module_param (pattern, uint, S_IRUGO|S_IWUSR);/* * if it's nonzero, autoresume says how many seconds to wait * before trying to wake up the host after suspend. */static unsigned autoresume = 0;module_param (autoresume, uint, 0);/* * Normally the "loopback" configuration is second (index 1) so * it's not the default.  Here's where to change that order, to * work better with hosts where config changes are problematic. * Or controllers (like superh) that only support one config. */static int loopdefault = 0;module_param (loopdefault, bool, S_IRUGO|S_IWUSR);/*-------------------------------------------------------------------------*//* Thanks to NetChip Technologies for donating this product ID. * * DO NOT REUSE THESE IDs with a protocol-incompatible driver!!  Ever!! * Instead:  allocate your own, using normal USB-IF procedures. */#ifndef	CONFIG_USB_ZERO_HNPTEST#define DRIVER_VENDOR_NUM	0x0525		/* NetChip */#define DRIVER_PRODUCT_NUM	0xa4a0		/* Linux-USB "Gadget Zero" */#else#define DRIVER_VENDOR_NUM	0x1a0a		/* OTG test device IDs */#define DRIVER_PRODUCT_NUM	0xbadd#endif/*-------------------------------------------------------------------------*//* * DESCRIPTORS ... most are static, but strings and (full) * configuration descriptors are built on demand. */#define STRING_MANUFACTURER		25#define STRING_PRODUCT			42#define STRING_SERIAL			101#define STRING_SOURCE_SINK		250#define STRING_LOOPBACK			251/* * This device advertises two configurations; these numbers work * on a pxa250 as well as more flexible hardware. */#define	CONFIG_SOURCE_SINK	3#define	CONFIG_LOOPBACK		2static struct usb_device_descriptordevice_desc = {	.bLength =		sizeof device_desc,	.bDescriptorType =	USB_DT_DEVICE,	.bcdUSB =		__constant_cpu_to_le16 (0x0200),	.bDeviceClass =		USB_CLASS_VENDOR_SPEC,	.idVendor =		__constant_cpu_to_le16 (DRIVER_VENDOR_NUM),	.idProduct =		__constant_cpu_to_le16 (DRIVER_PRODUCT_NUM),	.iManufacturer =	STRING_MANUFACTURER,	.iProduct =		STRING_PRODUCT,	.iSerialNumber =	STRING_SERIAL,	.bNumConfigurations =	2,};static struct usb_config_descriptorsource_sink_config = {	.bLength =		sizeof source_sink_config,	.bDescriptorType =	USB_DT_CONFIG,	/* compute wTotalLength on the fly */	.bNumInterfaces =	1,	.bConfigurationValue =	CONFIG_SOURCE_SINK,	.iConfiguration =	STRING_SOURCE_SINK,	.bmAttributes =		USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER,	.bMaxPower =		1,	/* self-powered */};static struct usb_config_descriptorloopback_config = {	.bLength =		sizeof loopback_config,	.bDescriptorType =	USB_DT_CONFIG,	/* compute wTotalLength on the fly */	.bNumInterfaces =	1,	.bConfigurationValue =	CONFIG_LOOPBACK,	.iConfiguration =	STRING_LOOPBACK,	.bmAttributes =		USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER,	.bMaxPower =		1,	/* self-powered */};static struct usb_otg_descriptorotg_descriptor = {	.bLength =		sizeof otg_descriptor,	.bDescriptorType =	USB_DT_OTG,	.bmAttributes =		USB_OTG_SRP,};/* one interface in each configuration */static const struct usb_interface_descriptorsource_sink_intf = {	.bLength =		sizeof source_sink_intf,	.bDescriptorType =	USB_DT_INTERFACE,	.bNumEndpoints =	2,	.bInterfaceClass =	USB_CLASS_VENDOR_SPEC,	.iInterface =		STRING_SOURCE_SINK,};static const struct usb_interface_descriptorloopback_intf = {	.bLength =		sizeof loopback_intf,	.bDescriptorType =	USB_DT_INTERFACE,	.bNumEndpoints =	2,	.bInterfaceClass =	USB_CLASS_VENDOR_SPEC,	.iInterface =		STRING_LOOPBACK,};/* two full speed bulk endpoints; their use is config-dependent */static struct usb_endpoint_descriptorfs_source_desc = {	.bLength =		USB_DT_ENDPOINT_SIZE,	.bDescriptorType =	USB_DT_ENDPOINT,	.bEndpointAddress =	USB_DIR_IN,	.bmAttributes =		USB_ENDPOINT_XFER_BULK,};static struct usb_endpoint_descriptorfs_sink_desc = {	.bLength =		USB_DT_ENDPOINT_SIZE,	.bDescriptorType =	USB_DT_ENDPOINT,	.bEndpointAddress =	USB_DIR_OUT,	.bmAttributes =		USB_ENDPOINT_XFER_BULK,};static const struct usb_descriptor_header *fs_source_sink_function [] = {	(struct usb_descriptor_header *) &otg_descriptor,	(struct usb_descriptor_header *) &source_sink_intf,	(struct usb_descriptor_header *) &fs_sink_desc,	(struct usb_descriptor_header *) &fs_source_desc,	NULL,};static const struct usb_descriptor_header *fs_loopback_function [] = {	(struct usb_descriptor_header *) &otg_descriptor,	(struct usb_descriptor_header *) &loopback_intf,	(struct usb_descriptor_header *) &fs_sink_desc,	(struct usb_descriptor_header *) &fs_source_desc,	NULL,};#ifdef	CONFIG_USB_GADGET_DUALSPEED/* * usb 2.0 devices need to expose both high speed and full speed * descriptors, unless they only run at full speed. * * that means alternate endpoint descriptors (bigger packets) * and a "device qualifier" ... plus more construction options * for the config descriptor. */static struct usb_endpoint_descriptorhs_source_desc = {	.bLength =		USB_DT_ENDPOINT_SIZE,	.bDescriptorType =	USB_DT_ENDPOINT,	.bmAttributes =		USB_ENDPOINT_XFER_BULK,	.wMaxPacketSize =	__constant_cpu_to_le16 (512),};static struct usb_endpoint_descriptorhs_sink_desc = {	.bLength =		USB_DT_ENDPOINT_SIZE,	.bDescriptorType =	USB_DT_ENDPOINT,	.bmAttributes =		USB_ENDPOINT_XFER_BULK,	.wMaxPacketSize =	__constant_cpu_to_le16 (512),};static struct usb_qualifier_descriptordev_qualifier = {	.bLength =		sizeof dev_qualifier,	.bDescriptorType =	USB_DT_DEVICE_QUALIFIER,	.bcdUSB =		__constant_cpu_to_le16 (0x0200),	.bDeviceClass =		USB_CLASS_VENDOR_SPEC,	.bNumConfigurations =	2,};static const struct usb_descriptor_header *hs_source_sink_function [] = {	(struct usb_descriptor_header *) &otg_descriptor,	(struct usb_descriptor_header *) &source_sink_intf,	(struct usb_descriptor_header *) &hs_source_desc,	(struct usb_descriptor_header *) &hs_sink_desc,	NULL,};static const struct usb_descriptor_header *hs_loopback_function [] = {	(struct usb_descriptor_header *) &otg_descriptor,	(struct usb_descriptor_header *) &loopback_intf,	(struct usb_descriptor_header *) &hs_source_desc,	(struct usb_descriptor_header *) &hs_sink_desc,	NULL,};/* maxpacket and other transfer characteristics vary by speed. */#define ep_desc(g,hs,fs) (((g)->speed==USB_SPEED_HIGH)?(hs):(fs))#else/* if there's no high speed support, maxpacket doesn't change. */#define ep_desc(g,hs,fs) fs#endif	/* !CONFIG_USB_GADGET_DUALSPEED */static char				manufacturer [50];static char				serial [40];/* static strings, in UTF-8 */static struct usb_string		strings [] = {	{ STRING_MANUFACTURER, manufacturer, },	{ STRING_PRODUCT, longname, },	{ STRING_SERIAL, serial, },	{ STRING_LOOPBACK, loopback, },	{ STRING_SOURCE_SINK, source_sink, },	{  }			/* end of list */};static struct usb_gadget_strings	stringtab = {	.language	= 0x0409,	/* en-us */	.strings	= strings,};/* * config descriptors are also handcrafted.  these must agree with code * that sets configurations, and with code managing interfaces and their * altsettings.  other complexity may come from: * *  - high speed support, including "other speed config" rules *  - multiple configurations *  - interfaces with alternate settings *  - embedded class or vendor-specific descriptors * * this handles high speed, and has a second config that could as easily * have been an alternate interface setting (on most hardware). * * NOTE:  to demonstrate (and test) more USB capabilities, this driver * should include an altsetting to test interrupt transfers, including * high bandwidth modes at high speed.  (Maybe work like Intel's test * device?) */static intconfig_buf (struct usb_gadget *gadget,		u8 *buf, u8 type, unsigned index){	int				is_source_sink;	int				len;	const struct usb_descriptor_header **function;#ifdef CONFIG_USB_GADGET_DUALSPEED	int				hs = (gadget->speed == USB_SPEED_HIGH);#endif	/* two configurations will always be index 0 and index 1 */	if (index > 1)		return -EINVAL;	is_source_sink = loopdefault ? (index == 1) : (index == 0);#ifdef CONFIG_USB_GADGET_DUALSPEED	if (type == USB_DT_OTHER_SPEED_CONFIG)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产日本欧洲亚洲| 国产精品自拍毛片| 欧美日韩久久久久久| 一区二区高清在线| 欧美精品久久久久久久久老牛影院| 一区二区三区欧美日韩| 欧美日韩国产小视频| 蜜桃av噜噜一区二区三区小说| 日韩精品一区二区在线| 国产91综合一区在线观看| 亚洲欧洲色图综合| 欧美另类久久久品| 国产高清在线观看免费不卡| 中文天堂在线一区| 欧美亚洲一区二区在线| 国内外成人在线视频| 亚洲欧洲精品一区二区三区不卡| 色妹子一区二区| 日本不卡一二三| 欧美经典一区二区| 欧美精品aⅴ在线视频| 国产suv精品一区二区三区| 亚洲婷婷国产精品电影人久久| 欧美日韩一区二区三区在线| 国产一区视频导航| 一区二区三区四区激情 | caoporn国产精品| 亚洲一区二区视频在线| www成人在线观看| 色综合天天综合网天天看片| 日韩av电影天堂| 亚洲欧美成人一区二区三区| 精品国产一区二区在线观看| 日本高清无吗v一区| 免费成人在线视频观看| 亚洲免费在线视频一区 二区| 在线成人免费视频| 5月丁香婷婷综合| 粉嫩在线一区二区三区视频| 亚洲6080在线| 亚洲欧美日韩国产一区二区三区 | 精品国产乱码久久| 欧美中文字幕亚洲一区二区va在线 | 91精品国产综合久久精品图片| 国产福利一区二区三区视频在线| 亚洲一区二区三区四区在线免费观看| 精品免费国产二区三区| 欧美性xxxxxxxx| 成人午夜私人影院| 蜜桃一区二区三区在线观看| 亚洲一区二区中文在线| 国产精品免费视频一区| 精品91自产拍在线观看一区| 678五月天丁香亚洲综合网| 成人av网站免费| 国产精品亚洲视频| 精品亚洲欧美一区| 亚洲国产乱码最新视频| 亚洲手机成人高清视频| 中文幕一区二区三区久久蜜桃| 精品毛片乱码1区2区3区| 欧美日韩国产综合草草| 色综合夜色一区| 99国产欧美另类久久久精品| 国产91综合一区在线观看| 国产精品一二三| 国产一区二区在线观看视频| 久久精品国产精品亚洲综合| 美女mm1313爽爽久久久蜜臀| 成人黄页在线观看| 极品少妇xxxx偷拍精品少妇| 美日韩黄色大片| 美腿丝袜亚洲一区| 久久99国产精品成人| 久久精品国产**网站演员| 免费观看成人av| 久久精品国产秦先生| 精品亚洲porn| 韩国女主播成人在线| 久久99国产精品免费网站| 国产一区美女在线| 国产东北露脸精品视频| 丁香网亚洲国际| 成人sese在线| 日本福利一区二区| 欧美日韩国产一二三| 欧美一区二区三区播放老司机| 91精品国产综合久久小美女| 欧美一级夜夜爽| 亚洲精品在线观看网站| 国产亚洲女人久久久久毛片| 国产精品高潮呻吟| 一区二区三区日韩在线观看| 五月天网站亚洲| 精品亚洲欧美一区| 成人久久久精品乱码一区二区三区 | 99久久er热在这里只有精品15| av中文一区二区三区| 日本韩国欧美在线| 欧美精品v国产精品v日韩精品| 日韩欧美在线123| 国产日产欧美一区| 亚洲综合在线第一页| 日本女优在线视频一区二区| 国产精品一区二区在线观看不卡 | 亚洲午夜久久久久久久久电影院| 婷婷综合另类小说色区| 老鸭窝一区二区久久精品| 国产99久久久精品| 欧美日韩视频一区二区| 久久久精品tv| 亚洲激情av在线| 久久精品999| 色先锋久久av资源部| 日韩欧美国产一二三区| 日韩美女精品在线| 蜜臀av性久久久久蜜臀av麻豆| 成人福利视频网站| 欧美成人女星排名| 亚洲精品亚洲人成人网| 韩国av一区二区三区在线观看| 91在线小视频| 久久综合久久久久88| 亚洲一区二区美女| 粉嫩欧美一区二区三区高清影视| 欧美军同video69gay| 国产精品日产欧美久久久久| 日韩综合一区二区| 97久久精品人人澡人人爽| 精品国产一区二区精华 | 日韩成人午夜电影| 不卡的电影网站| 精品裸体舞一区二区三区| 午夜精品久久久久久久蜜桃app| 高清国产午夜精品久久久久久| 91超碰这里只有精品国产| 国产精品欧美一级免费| 久久精品国产亚洲一区二区三区 | 欧美一区二区三区婷婷月色 | 一区二区视频免费在线观看| 国产成人免费9x9x人网站视频| 欧美精品18+| 亚洲一级二级三级| 99在线精品一区二区三区| 精品国产乱码久久久久久免费| 亚洲成在人线在线播放| 色偷偷久久一区二区三区| 日本一区二区高清| 久久国产精品露脸对白| 555www色欧美视频| 午夜欧美一区二区三区在线播放| 91原创在线视频| 国产精品乱人伦一区二区| 激情丁香综合五月| 日韩欧美国产一区二区三区| 视频在线在亚洲| 欧美剧情电影在线观看完整版免费励志电影| 国产精品成人免费| 成人美女视频在线看| 国产精品麻豆网站| 成人精品免费看| 国产精品麻豆久久久| 不卡的电影网站| 亚洲欧洲另类国产综合| 91性感美女视频| 中文字幕亚洲综合久久菠萝蜜| 丰满放荡岳乱妇91ww| 国产人妖乱国产精品人妖| 国产精品自产自拍| 国产午夜久久久久| 成人网在线免费视频| 国产精品剧情在线亚洲| 92国产精品观看| 亚洲免费观看在线观看| 91成人国产精品| 天堂一区二区在线免费观看| 91精品国产综合久久精品 | 狠狠狠色丁香婷婷综合激情| 日韩欧美精品在线| 国产一区二区三区日韩| 国产日韩欧美精品在线| av中文字幕亚洲| 亚洲国产欧美日韩另类综合 | 欧美日韩aaaaa| 青青草国产成人av片免费| 精品国产伦理网| 国产宾馆实践打屁股91| 一区二区三区电影在线播| 91精品国产免费| 国产高清成人在线| 自拍视频在线观看一区二区| 欧美三级蜜桃2在线观看| 人禽交欧美网站| 久久蜜桃av一区二区天堂| av网站一区二区三区| 亚洲国产婷婷综合在线精品| 日韩亚洲欧美综合| 成人在线视频一区二区| 亚洲综合一区在线| 久久久九九九九|