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

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

?? hc_crisv10.c

?? host usb 主設備程序 支持sd卡 mouse keyboard 的最單單的驅動程序 gcc編譯
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* * usb-host.c: ETRAX 100LX USB Host Controller Driver (HCD) * * Copyright (c) 2002, 2003 Axis Communications AB. */#include <linux/kernel.h>#include <linux/delay.h>#include <linux/ioport.h>#include <linux/slab.h>#include <linux/errno.h>#include <linux/unistd.h>#include <linux/interrupt.h>#include <linux/init.h>#include <linux/list.h>#include <linux/spinlock.h>#include <asm/uaccess.h>#include <asm/io.h>#include <asm/irq.h>#include <asm/dma.h>#include <asm/system.h>#include <asm/arch/svinto.h>#include <linux/usb.h>/* Ugly include because we don't live with the other host drivers. */#include <../drivers/usb/core/hcd.h>#include <../drivers/usb/core/usb.h>#include "hc_crisv10.h"#define ETRAX_USB_HC_IRQ USB_HC_IRQ_NBR#define ETRAX_USB_RX_IRQ USB_DMA_RX_IRQ_NBR#define ETRAX_USB_TX_IRQ USB_DMA_TX_IRQ_NBRstatic const char *usb_hcd_version = "$Revision: 1.1.1.1 $";#undef KERN_DEBUG#define KERN_DEBUG ""#undef USB_DEBUG_RH#undef USB_DEBUG_EPID#undef USB_DEBUG_SB#undef USB_DEBUG_DESC#undef USB_DEBUG_URB#undef USB_DEBUG_TRACE#undef USB_DEBUG_BULK#undef USB_DEBUG_CTRL#undef USB_DEBUG_INTR#undef USB_DEBUG_ISOC#ifdef USB_DEBUG_RH#define dbg_rh(format, arg...) printk(KERN_DEBUG __FILE__ ": (RH) " format "\n" , ## arg)#else#define dbg_rh(format, arg...) do {} while (0)#endif#ifdef USB_DEBUG_EPID#define dbg_epid(format, arg...) printk(KERN_DEBUG __FILE__ ": (EPID) " format "\n" , ## arg)#else#define dbg_epid(format, arg...) do {} while (0)#endif#ifdef USB_DEBUG_SB#define dbg_sb(format, arg...) printk(KERN_DEBUG __FILE__ ": (SB) " format "\n" , ## arg)#else#define dbg_sb(format, arg...) do {} while (0)#endif#ifdef USB_DEBUG_CTRL#define dbg_ctrl(format, arg...) printk(KERN_DEBUG __FILE__ ": (CTRL) " format "\n" , ## arg)#else#define dbg_ctrl(format, arg...) do {} while (0)#endif#ifdef USB_DEBUG_BULK#define dbg_bulk(format, arg...) printk(KERN_DEBUG __FILE__ ": (BULK) " format "\n" , ## arg)#else#define dbg_bulk(format, arg...) do {} while (0)#endif#ifdef USB_DEBUG_INTR#define dbg_intr(format, arg...) printk(KERN_DEBUG __FILE__ ": (INTR) " format "\n" , ## arg)#else#define dbg_intr(format, arg...) do {} while (0)#endif#ifdef USB_DEBUG_ISOC#define dbg_isoc(format, arg...) printk(KERN_DEBUG __FILE__ ": (ISOC) " format "\n" , ## arg)#else#define dbg_isoc(format, arg...) do {} while (0)#endif#ifdef USB_DEBUG_TRACE#define DBFENTER (printk(": Entering: %s\n", __FUNCTION__))#define DBFEXIT  (printk(": Exiting:  %s\n", __FUNCTION__))#else#define DBFENTER do {} while (0)#define DBFEXIT  do {} while (0)#endif#define usb_pipeslow(pipe)	(((pipe) >> 26) & 1)/*------------------------------------------------------------------- Virtual Root Hub -------------------------------------------------------------------*/static __u8 root_hub_dev_des[] ={	0x12,  /*  __u8  bLength; */	0x01,  /*  __u8  bDescriptorType; Device */	0x00,  /*  __le16 bcdUSB; v1.0 */	0x01,	0x09,  /*  __u8  bDeviceClass; HUB_CLASSCODE */	0x00,  /*  __u8  bDeviceSubClass; */	0x00,  /*  __u8  bDeviceProtocol; */	0x08,  /*  __u8  bMaxPacketSize0; 8 Bytes */	0x00,  /*  __le16 idVendor; */	0x00,	0x00,  /*  __le16 idProduct; */	0x00,	0x00,  /*  __le16 bcdDevice; */	0x00,	0x00,  /*  __u8  iManufacturer; */	0x02,  /*  __u8  iProduct; */	0x01,  /*  __u8  iSerialNumber; */	0x01   /*  __u8  bNumConfigurations; */};/* Configuration descriptor */static __u8 root_hub_config_des[] ={	0x09,  /*  __u8  bLength; */	0x02,  /*  __u8  bDescriptorType; Configuration */	0x19,  /*  __le16 wTotalLength; */	0x00,	0x01,  /*  __u8  bNumInterfaces; */	0x01,  /*  __u8  bConfigurationValue; */	0x00,  /*  __u8  iConfiguration; */	0x40,  /*  __u8  bmAttributes; Bit 7: Bus-powered */	0x00,  /*  __u8  MaxPower; */     /* interface */	0x09,  /*  __u8  if_bLength; */	0x04,  /*  __u8  if_bDescriptorType; Interface */	0x00,  /*  __u8  if_bInterfaceNumber; */	0x00,  /*  __u8  if_bAlternateSetting; */	0x01,  /*  __u8  if_bNumEndpoints; */	0x09,  /*  __u8  if_bInterfaceClass; HUB_CLASSCODE */	0x00,  /*  __u8  if_bInterfaceSubClass; */	0x00,  /*  __u8  if_bInterfaceProtocol; */	0x00,  /*  __u8  if_iInterface; */     /* endpoint */	0x07,  /*  __u8  ep_bLength; */	0x05,  /*  __u8  ep_bDescriptorType; Endpoint */	0x81,  /*  __u8  ep_bEndpointAddress; IN Endpoint 1 */	0x03,  /*  __u8  ep_bmAttributes; Interrupt */	0x08,  /*  __le16 ep_wMaxPacketSize; 8 Bytes */	0x00,	0xff   /*  __u8  ep_bInterval; 255 ms */};static __u8 root_hub_hub_des[] ={	0x09,  /*  __u8  bLength; */	0x29,  /*  __u8  bDescriptorType; Hub-descriptor */	0x02,  /*  __u8  bNbrPorts; */	0x00,  /* __u16  wHubCharacteristics; */	0x00,	0x01,  /*  __u8  bPwrOn2pwrGood; 2ms */	0x00,  /*  __u8  bHubContrCurrent; 0 mA */	0x00,  /*  __u8  DeviceRemovable; *** 7 Ports max *** */	0xff   /*  __u8  PortPwrCtrlMask; *** 7 ports max *** */};static DEFINE_TIMER(bulk_start_timer, NULL, 0, 0);static DEFINE_TIMER(bulk_eot_timer, NULL, 0, 0);/* We want the start timer to expire before the eot timer, because the former might start   traffic, thus making it unnecessary for the latter to time out. */#define BULK_START_TIMER_INTERVAL (HZ/10) /* 100 ms */#define BULK_EOT_TIMER_INTERVAL (HZ/10+2) /* 120 ms */#define OK(x) len = (x); dbg_rh("OK(%d): line: %d", x, __LINE__); break#define CHECK_ALIGN(x) if (((__u32)(x)) & 0x00000003) \{panic("Alignment check (DWORD) failed at %s:%s:%d\n", __FILE__, __FUNCTION__, __LINE__);}#define SLAB_FLAG     (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL)#define KMALLOC_FLAG  (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL)/* Most helpful debugging aid */#define assert(expr) ((void) ((expr) ? 0 : (err("assert failed at line %d",__LINE__))))/* Alternative assert define which stops after a failed assert. *//*#define assert(expr)                                      \{                                                         \        if (!(expr)) {                                    \                err("assert failed at line %d",__LINE__); \                while (1);                                \        }                                                 \}*//* FIXME: Should RX_BUF_SIZE be a config option, or maybe we should adjust it dynamically?   To adjust it dynamically we would have to get an interrupt when we reach the end   of the rx descriptor list, or when we get close to the end, and then allocate more   descriptors. */#define NBR_OF_RX_DESC     512#define RX_DESC_BUF_SIZE   1024#define RX_BUF_SIZE        (NBR_OF_RX_DESC * RX_DESC_BUF_SIZE)/* The number of epids is, among other things, used for pre-allocating   ctrl, bulk and isoc EP descriptors (one for each epid).   Assumed to be > 1 when initiating the DMA lists. */#define NBR_OF_EPIDS       32/* Support interrupt traffic intervals up to 128 ms. */#define MAX_INTR_INTERVAL 128/* If periodic traffic (intr or isoc) is to be used, then one entry in the EP table   must be "invalid". By this we mean that we shouldn't care about epid attentions   for this epid, or at least handle them differently from epid attentions for "valid"   epids. This define determines which one to use (don't change it). */#define INVALID_EPID     31/* A special epid for the bulk dummys. */#define DUMMY_EPID       30/* This is just a software cache for the valid entries in R_USB_EPT_DATA. */static __u32 epid_usage_bitmask;/* A bitfield to keep information on in/out traffic is needed to uniquely identify   an endpoint on a device, since the most significant bit which indicates traffic   direction is lacking in the ep_id field (ETRAX epids can handle both in and   out traffic on endpoints that are otherwise identical). The USB framework, however,   relies on them to be handled separately.  For example, bulk IN and OUT urbs cannot   be queued in the same list, since they would block each other. */static __u32 epid_out_traffic;/* DMA IN cache bug. Align the DMA IN buffers to 32 bytes, i.e. a cache line.   Since RX_DESC_BUF_SIZE is 1024 is a multiple of 32, all rx buffers will be cache aligned. */static volatile unsigned char RxBuf[RX_BUF_SIZE] __attribute__ ((aligned (32)));static volatile USB_IN_Desc_t RxDescList[NBR_OF_RX_DESC] __attribute__ ((aligned (4)));/* Pointers into RxDescList. */static volatile USB_IN_Desc_t *myNextRxDesc;static volatile USB_IN_Desc_t *myLastRxDesc;static volatile USB_IN_Desc_t *myPrevRxDesc;/* EP descriptors must be 32-bit aligned. */static volatile USB_EP_Desc_t TxCtrlEPList[NBR_OF_EPIDS] __attribute__ ((aligned (4)));static volatile USB_EP_Desc_t TxBulkEPList[NBR_OF_EPIDS] __attribute__ ((aligned (4)));/* After each enabled bulk EP (IN or OUT) we put two disabled EP descriptors with the eol flag set,   causing the DMA to stop the DMA channel. The first of these two has the intr flag set, which   gives us a dma8_sub0_descr interrupt. When we receive this, we advance the DMA one step in the   EP list and then restart the bulk channel, thus forcing a switch between bulk EP descriptors   in each frame. */static volatile USB_EP_Desc_t TxBulkDummyEPList[NBR_OF_EPIDS][2] __attribute__ ((aligned (4)));static volatile USB_EP_Desc_t TxIsocEPList[NBR_OF_EPIDS] __attribute__ ((aligned (4)));static volatile USB_SB_Desc_t TxIsocSB_zout __attribute__ ((aligned (4)));static volatile USB_EP_Desc_t TxIntrEPList[MAX_INTR_INTERVAL] __attribute__ ((aligned (4)));static volatile USB_SB_Desc_t TxIntrSB_zout __attribute__ ((aligned (4)));/* A zout transfer makes a memory access at the address of its buf pointer, which means that setting   this buf pointer to 0 will cause an access to the flash. In addition to this, setting sw_len to 0   results in a 16/32 bytes (depending on DMA burst size) transfer. Instead, we set it to 1, and point   it to this buffer. */static int zout_buffer[4] __attribute__ ((aligned (4)));/* Cache for allocating new EP and SB descriptors. */static struct kmem_cache *usb_desc_cache;/* Cache for the registers allocated in the top half. */static struct kmem_cache *top_half_reg_cache;/* Cache for the data allocated in the isoc descr top half. */static struct kmem_cache *isoc_compl_cache;static struct usb_bus *etrax_usb_bus;/* This is a circular (double-linked) list of the active urbs for each epid.   The head is never removed, and new urbs are linked onto the list as   urb_entry_t elements. Don't reference urb_list directly; use the wrapper   functions instead. Note that working with these lists might require spinlock   protection. */static struct list_head urb_list[NBR_OF_EPIDS];/* Read about the need and usage of this lock in submit_ctrl_urb. */static spinlock_t urb_list_lock;/* Used when unlinking asynchronously. */static struct list_head urb_unlink_list;/* for returning string descriptors in UTF-16LE */static int ascii2utf (char *ascii, __u8 *utf, int utfmax){	int retval;	for (retval = 0; *ascii && utfmax > 1; utfmax -= 2, retval += 2) {		*utf++ = *ascii++ & 0x7f;		*utf++ = 0;	}	return retval;}static int usb_root_hub_string (int id, int serial, char *type, __u8 *data, int len){	char buf [30];	// assert (len > (2 * (sizeof (buf) + 1)));	// assert (strlen (type) <= 8);	// language ids	if (id == 0) {		*data++ = 4; *data++ = 3;	/* 4 bytes data */		*data++ = 0; *data++ = 0;	/* some language id */		return 4;	// serial number	} else if (id == 1) {		sprintf (buf, "%x", serial);	// product description	} else if (id == 2) {		sprintf (buf, "USB %s Root Hub", type);	// id 3 == vendor description	// unsupported IDs --> "stall"	} else	    return 0;	data [0] = 2 + ascii2utf (buf, data + 2, len - 2);	data [1] = 3;	return data [0];}/* Wrappers around the list functions (include/linux/list.h). */static inline int urb_list_empty(int epid){	return list_empty(&urb_list[epid]);}/* Returns first urb for this epid, or NULL if list is empty. */static inline struct urb *urb_list_first(int epid){	struct urb *first_urb = 0;	if (!urb_list_empty(epid)) {		/* Get the first urb (i.e. head->next). */		urb_entry_t *urb_entry = list_entry((&urb_list[epid])->next, urb_entry_t, list);		first_urb = urb_entry->urb;	}	return first_urb;}/* Adds an urb_entry last in the list for this epid. */static inline void urb_list_add(struct urb *urb, int epid){	urb_entry_t *urb_entry = kmalloc(sizeof(urb_entry_t), KMALLOC_FLAG);	assert(urb_entry);	urb_entry->urb = urb;	list_add_tail(&urb_entry->list, &urb_list[epid]);}/* Search through the list for an element that contains this urb. (The list   is expected to be short and the one we are about to delete will often be   the first in the list.) */static inline urb_entry_t *__urb_list_entry(struct urb *urb, int epid){	struct list_head *entry;	struct list_head *tmp;	urb_entry_t *urb_entry;	list_for_each_safe(entry, tmp, &urb_list[epid]) {		urb_entry = list_entry(entry, urb_entry_t, list);		assert(urb_entry);		assert(urb_entry->urb);		if (urb_entry->urb == urb) {			return urb_entry;		}	}	return 0;}/* Delete an urb from the list. */static inline void urb_list_del(struct urb *urb, int epid){	urb_entry_t *urb_entry = __urb_list_entry(urb, epid);	assert(urb_entry);	/* Delete entry and free. */	list_del(&urb_entry->list);	kfree(urb_entry);}/* Move an urb to the end of the list. */static inline void urb_list_move_last(struct urb *urb, int epid){	urb_entry_t *urb_entry = __urb_list_entry(urb, epid);	assert(urb_entry);	list_move_tail(&urb_entry->list, &urb_list[epid]);}/* Get the next urb in the list. */static inline struct urb *urb_list_next(struct urb *urb, int epid){	urb_entry_t *urb_entry = __urb_list_entry(urb, epid);	assert(urb_entry);	if (urb_entry->list.next != &urb_list[epid]) {		struct list_head *elem = urb_entry->list.next;		urb_entry = list_entry(elem, urb_entry_t, list);		return urb_entry->urb;	} else {		return NULL;	}}/* For debug purposes only. */static inline void urb_list_dump(int epid){	struct list_head *entry;	struct list_head *tmp;	urb_entry_t *urb_entry;	int i = 0;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品白丝在线| 日韩免费高清电影| 精品国产一区二区精华| 国产精品短视频| 久久99精品久久久久婷婷| av在线免费不卡| 久久久久久久久久久99999| 亚洲精品五月天| 国产高清无密码一区二区三区| 欧美最猛黑人xxxxx猛交| 国产欧美va欧美不卡在线| 图片区日韩欧美亚洲| 色老汉av一区二区三区| 精品国产sm最大网站| 香蕉成人啪国产精品视频综合网 | 亚洲激情校园春色| 国产剧情一区在线| 日韩精品一区二区三区在线| 亚洲一二三四久久| 在线免费亚洲电影| 亚洲乱码国产乱码精品精的特点| 国产成a人亚洲精品| 久久蜜臀精品av| 国产乱码精品一区二区三区五月婷| 欧美精品自拍偷拍动漫精品| 亚洲福利电影网| 在线不卡的av| 日韩和欧美一区二区| 在线播放欧美女士性生活| 午夜精品一区二区三区三上悠亚| 国产成人小视频| 国产午夜亚洲精品理论片色戒| 久久99精品久久久久久| 精品日韩av一区二区| 精品在线免费观看| 久久毛片高清国产| 波多野结衣一区二区三区| 国产精品黄色在线观看| 色婷婷精品大在线视频| 亚洲成人综合网站| 日韩一区二区三区高清免费看看 | 免费国产亚洲视频| 日韩一级视频免费观看在线| 久久精品国产**网站演员| 久久欧美中文字幕| 成人午夜激情视频| 一区二区三区在线视频观看| 欧美日韩一区二区欧美激情| 首页国产欧美日韩丝袜| 精品国产欧美一区二区| 丁香五精品蜜臀久久久久99网站| 亚洲三级在线免费| 欧美一区国产二区| 国产精品99久久久久久有的能看 | 亚洲成人免费av| 欧美成人vps| 成人蜜臀av电影| 亚洲无人区一区| 久久综合九色欧美综合狠狠| 成人免费视频一区二区| 午夜国产不卡在线观看视频| 精品福利视频一区二区三区| 99这里都是精品| 日本强好片久久久久久aaa| 欧美国产欧美亚州国产日韩mv天天看完整 | 欧美久久久影院| 国产精品一区专区| 亚洲一区二区五区| 精品嫩草影院久久| 色一区在线观看| 国产精品亚洲第一区在线暖暖韩国| 国产精品对白交换视频| 欧美一区二区三区视频| a级精品国产片在线观看| 视频一区在线视频| 亚洲欧洲日韩在线| 欧美一区二区美女| 色噜噜狠狠成人中文综合| 国产精品白丝jk黑袜喷水| 午夜精品影院在线观看| 亚洲色图丝袜美腿| 久久先锋资源网| 在线国产亚洲欧美| 春色校园综合激情亚洲| 亚洲成国产人片在线观看| 国产精品初高中害羞小美女文| 日韩一区二区在线免费观看| 91色.com| 99久久精品国产观看| 国产高清久久久| 狠狠色狠狠色综合| 青椒成人免费视频| 亚洲.国产.中文慕字在线| 亚洲欧美日韩国产综合在线 | 一区二区三区在线视频免费| 久久久久久97三级| 日韩你懂的电影在线观看| 欧美精品在欧美一区二区少妇| 不卡一区二区三区四区| 国产成人午夜精品5599| 精品一区二区三区免费毛片爱| 亚洲国产成人高清精品| 亚洲免费毛片网站| 一区二区三区中文字幕电影 | 色综合色综合色综合色综合色综合 | 欧美视频一二三区| 在线免费观看成人短视频| 色婷婷久久久亚洲一区二区三区| 成人h动漫精品一区二区| 成人一道本在线| 成人激情小说网站| 成人av网址在线| 99久久国产综合色|国产精品| av中文字幕不卡| 91免费国产在线观看| 一本大道久久精品懂色aⅴ| 91在线视频播放地址| 色综合久久综合中文综合网| 一本色道亚洲精品aⅴ| 欧美亚洲禁片免费| 欧美午夜精品电影| 欧美肥胖老妇做爰| 日韩免费一区二区| 国产亚洲美州欧州综合国 | 日韩欧美卡一卡二| 日韩色在线观看| 日韩欧美亚洲国产精品字幕久久久| 日韩欧美中文字幕公布| 精品电影一区二区三区| 国产亚洲综合在线| 综合久久综合久久| 亚洲男人的天堂在线aⅴ视频| 一区二区理论电影在线观看| 天堂蜜桃91精品| 韩日精品视频一区| 99久久国产综合精品麻豆| 欧美视频第二页| 精品久久一区二区三区| 国产精品久久久久一区 | 最新欧美精品一区二区三区| 亚洲精品中文在线| 免费欧美日韩国产三级电影| 国产精品影音先锋| 欧美日韩亚洲不卡| 久久久不卡影院| 亚洲第一精品在线| 国产福利91精品一区二区三区| 色婷婷av一区二区三区大白胸| 91精品中文字幕一区二区三区| 久久精品亚洲一区二区三区浴池| 亚洲欧美成人一区二区三区| 日韩精品91亚洲二区在线观看 | 日韩一区二区在线观看视频| 欧美亚洲国产一区二区三区va| 91网页版在线| 在线亚洲人成电影网站色www| 一本大道av伊人久久综合| 色综合久久久久| 欧美日韩国产综合视频在线观看| 欧美视频精品在线观看| 91精品国产免费| 欧美成人精品福利| 欧美国产日韩在线观看| 亚洲欧美一区二区久久| 亚洲五月六月丁香激情| 麻豆成人久久精品二区三区小说| 久久精品国产99| 成人性生交大片免费看视频在线| 9久草视频在线视频精品| 欧美午夜影院一区| 精品乱码亚洲一区二区不卡| 国产精品美女一区二区| 亚洲综合色网站| 免费成人美女在线观看| 成人美女在线视频| 欧美日韩精品一区二区三区四区| 日韩视频123| 国产精品久久久久9999吃药| 亚洲电影视频在线| 国产毛片一区二区| 91在线国内视频| 欧美一级欧美三级在线观看 | 在线一区二区三区做爰视频网站| 欧美日韩你懂的| 91小视频在线免费看| 精品国产乱码久久久久久图片 | proumb性欧美在线观看| 国产午夜一区二区三区| 国内精品久久久久影院色| 欧美日韩国产高清一区| 亚洲综合av网| 色菇凉天天综合网| 亚洲免费视频成人| 日本国产一区二区| 一区二区三区精品视频在线| 91天堂素人约啪| 亚洲免费资源在线播放| 色综合久久天天| 亚洲第一综合色| 日韩三级av在线播放|