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

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

?? s3c2410_udc.c

?? s3c2410 usb device controller 的驅動程序
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* * linux/drivers/usb/gadget/s3c2410_udc.c * Samsung on-chip full speed USB device controllers * * Copyright (C) 2004 Herbert P鰐zl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * */#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/version.h>#include <linux/usb.h>#include <linux/usb_gadget.h>/* remove this ASAP!!! */// #include "../core/hub.h"#include <asm/byteorder.h>#include <asm/io.h>#include <asm/irq.h>#include <asm/system.h>#include <asm/unaligned.h>#include <asm/arch/irqs.h>#include <asm/arch/h1940.h>#include <asm/arch/hardware.h>#include <asm/arch/regs-clock.h>#include <asm/arch/regs-gpio.h>#include <asm/arch/regs-usb.h>#include "s3c2410_udc.h"#define dprintk(x...)	printk("USB: " x)#define DRIVER_DESC     "S3C2410 USB Device Controller Gadget"#define DRIVER_VERSION  "14 Mar 2004"static const char	gadget_name [] = "s3c2410_udc";/*-------------------------------------------------------------------------*/struct s3c2410_udc;struct s3c2410_ep {	struct list_head		queue;	unsigned long			last_io;	/* jiffies timestamp */	struct usb_gadget		*gadget;	struct s3c2410_udc		*dev;	const struct usb_endpoint_descriptor *desc;	struct usb_ep			ep;	unsigned short			fifo_size;	u8				bEndpointAddress;	u8				bmAttributes;	unsigned			halted : 1;	unsigned			already_seen : 1;	unsigned			setup_stage : 1;};struct s3c2410_request {	struct list_head		queue;		/* ep's requests */	struct usb_request		req;};/*-------------------------------------------------------------------------*//* * Every device has ep0 for control requests, plus up to 30 more endpoints. * * Gadget drivers are responsible for not setting up conflicting endpoint * configurations, illegal or unsupported packet lengths, and so on. */static const char ep0name [] = "ep0";static const char *const ep_name[] = {	ep0name,				/* everyone has ep0 */	/* s3c2410 four bidirectional bulk endpoints */	"ep1", "ep2", "ep3", "ep4",};#define S3C2410_ENDPOINTS	ARRAY_SIZE(ep_name)#define FIFO_SIZE		64struct s3c2410_udc {	spinlock_t			lock;	struct s3c2410_ep		ep[S3C2410_ENDPOINTS];	int				address;	struct usb_gadget		gadget;	struct usb_gadget_driver	*driver;	struct s3c2410_request		fifo_req;	u8				fifo_buf[FIFO_SIZE];	u16				devstatus;		u32				port_status;    	int 	    	    	    	ep0state;	unsigned			got_irq : 1;		unsigned			req_std : 1;	unsigned			req_config : 1;	unsigned			req_pending : 1;};static struct s3c2410_udc *the_controller;/*-------------------------------------------------------------------------*//* *  	Gadget Helpers */static inlinestruct s3c2410_udc *ep_to_udc (struct s3c2410_ep *ep){	return container_of (ep->gadget, struct s3c2410_udc, gadget);}static inlinestruct s3c2410_udc *gadget_dev_to_udc (struct device *dev){	return container_of (dev, struct s3c2410_udc, gadget.dev);}/* called with spinlock held */static void nuke (struct s3c2410_udc *udc, struct s3c2410_ep *ep){	while (!list_empty (&ep->queue)) {		struct s3c2410_request	*req;		req = list_entry (ep->queue.next, struct s3c2410_request, queue);		list_del_init (&req->queue);		req->req.status = -ESHUTDOWN;		spin_unlock (&udc->lock);		req->req.complete (&ep->ep, &req->req);		spin_lock (&udc->lock);	}}static voidfifo_complete (struct usb_ep *ep, struct usb_request *req){	dprintk( "fifo_complete: %d\n", req->status);}/*-------------------------------------------------------------------------*//* *  	Gadget Operations */static ints3c2410_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc){	struct s3c2410_udc	*udc;	struct s3c2410_ep	*ep;	unsigned		max;	int			retval;    	printk("s3c2410_enable():\n");	ep = container_of (_ep, struct s3c2410_ep, ep);/*			if (!the_controller->driver || !is_enabled ())		return -ESHUTDOWN;*/	max = desc->wMaxPacketSize & 0x3ff;	/* drivers must not request bad settings, since lower levels	 * (hardware or its drivers) may not check.  some endpoints	 * can't do iso, many have maxpacket limitations, etc.	 */	udc = container_of (ep->gadget, struct s3c2410_udc, gadget);	retval = -EINVAL;	switch (desc->bmAttributes & 0x03) {	case USB_ENDPOINT_XFER_BULK:		switch (udc->gadget.speed) {		case USB_SPEED_HIGH:			if (max == 512)				break;			/* conserve return statements */		default:			switch (max) {			case 8: case 16: case 32: case 64:				/* we'll fake any legal size */				break;			default:		case USB_SPEED_LOW:				goto done;			}		}		break;	case USB_ENDPOINT_XFER_INT:		switch (udc->gadget.speed) {		case USB_SPEED_HIGH:			if (max <= 1024)				break;			/* save a return statement */		case USB_SPEED_FULL:			if (max <= 64)				break;			/* save a return statement */		default:			if (max <= 8)				break;			goto done;		}		break;	case USB_ENDPOINT_XFER_ISOC:		/* real hardware might not handle all packet sizes */		switch (udc->gadget.speed) {		case USB_SPEED_HIGH:			if (max <= 1024)				break;			/* save a return statement */		case USB_SPEED_FULL:			if (max <= 1023)				break;			/* save a return statement */		default:			goto done;		}		break;	default:		/* few chips support control except on ep0 */		goto done;	}	_ep->maxpacket = max;	ep->desc = desc;	dprintk( "enabled %s (ep%d%s-%s) maxpacket %d\n",		_ep->name,		desc->bEndpointAddress & 0x0f,		(desc->bEndpointAddress & USB_DIR_IN) ? "in" : "out",		({ char *val;		 switch (desc->bmAttributes & 0x03) {		 case USB_ENDPOINT_XFER_BULK: val = "bulk"; break;		 case USB_ENDPOINT_XFER_ISOC: val = "iso"; break;		 case USB_ENDPOINT_XFER_INT: val = "intr"; break;		 default: val = "ctrl"; break;		 }; val; }),		max);	/* at this point real hardware should be NAKing transfers	 * to that endpoint, until a buffer is queued to it.	 */	retval = 0;done:	return retval;}static int s3c2410_disable (struct usb_ep *_ep){	struct s3c2410_ep	*ep;	struct s3c2410_udc	*udc;	unsigned long		flags;	int			retval;    	printk("s3c2410_disable()\n");		ep = container_of (_ep, struct s3c2410_ep, ep);	if (!_ep || !ep->desc || _ep->name == ep0name)		return -EINVAL;	udc = ep_to_udc (ep);	spin_lock_irqsave (&udc->lock, flags);	ep->desc = 0;	retval = 0;	nuke (udc, ep);	spin_unlock_irqrestore (&udc->lock, flags);	dprintk( "disabled %s\n", _ep->name);	return retval;}static struct usb_request *s3c2410_alloc_request (struct usb_ep *_ep, int mem_flags){	struct s3c2410_ep	*ep;	struct s3c2410_request	*req;    	printk("s3c2410_alloc_request(ep=%p,flags=%d)\n", _ep, mem_flags);	ep = container_of (_ep, struct s3c2410_ep, ep);	if (!_ep)		return 0;	req = kmalloc (sizeof *req, mem_flags);	if (!req)		return 0;	memset (req, 0, sizeof *req);	INIT_LIST_HEAD (&req->queue);	return &req->req;}static voids3c2410_free_request (struct usb_ep *_ep, struct usb_request *_req){	struct s3c2410_ep	*ep;	struct s3c2410_request	*req;    	printk("s3c2410_free_request(ep=%p,req=%p)\n", _ep, _req);	ep = container_of (_ep, struct s3c2410_ep, ep);	if (!ep || !_req || (!ep->desc && _ep->name != ep0name))		return;	req = container_of (_req, struct s3c2410_request, req);	WARN_ON (!list_empty (&req->queue));	kfree (req);}static void *s3c2410_alloc_buffer (	struct usb_ep *_ep,	unsigned bytes,	dma_addr_t *dma,	int mem_flags){	char *retval;    	printk("s3c2410_alloc_buffer()\n");	if (!the_controller->driver)		return 0;	retval = kmalloc (bytes, mem_flags);	*dma = (dma_addr_t) retval;	return retval;}static voids3c2410_free_buffer (	struct usb_ep *_ep,	void *buf,	dma_addr_t dma,	unsigned bytes){    	printk("s3c2410_free_buffer()\n");	if (bytes)		kfree (buf);}static ints3c2410_queue (struct usb_ep *_ep, struct usb_request *_req, int mem_flags){	struct s3c2410_ep	*ep;	struct s3c2410_request	*req;	struct s3c2410_udc	*udc;	unsigned long		flags;    	printk("s3c2410_queue(ep=%p,req=%p,mem=%d)\n",	    	_ep, _req, mem_flags);	req = container_of (_req, struct s3c2410_request, req);	if (!_req || !list_empty (&req->queue) || !_req->complete)		return -EINVAL;	ep = container_of (_ep, struct s3c2410_ep, ep);	if (!_ep || (!ep->desc && _ep->name != ep0name))		return -EINVAL;/*	if (!the_controller->driver || !is_enabled ())		return -ESHUTDOWN;*/	udc = container_of (ep->gadget, struct s3c2410_udc, gadget);	dprintk( "ep %p queue req %p to %s, len %d buf %p\n",		ep, _req, _ep->name, _req->length, _req->buf);	_req->status = -EINPROGRESS;	_req->actual = 0;	spin_lock_irqsave (&udc->lock, flags);	/* implement an emulated single-request FIFO */	if (ep->desc && (ep->desc->bEndpointAddress & USB_DIR_IN) &&			list_empty (&udc->fifo_req.queue) &&			list_empty (&ep->queue) &&			_req->length <= FIFO_SIZE) {		req = &udc->fifo_req;		req->req = *_req;		req->req.buf = udc->fifo_buf;		memcpy (udc->fifo_buf, _req->buf, _req->length);		req->req.context = udc;		req->req.complete = fifo_complete;		spin_unlock (&udc->lock);		_req->actual = _req->length;		_req->status = 0;		_req->complete (_ep, _req);		spin_lock (&udc->lock);	}	list_add_tail (&req->queue, &ep->queue);	spin_unlock_irqrestore (&udc->lock, flags);	/* real hardware would likely enable transfers here, in case	 * it'd been left NAKing.	 */	return 0;}static int s3c2410_dequeue (struct usb_ep *_ep, struct usb_request *_req){	struct s3c2410_ep	*ep;	struct s3c2410_udc	*udc;	int			retval = -EINVAL;	unsigned long		flags;	struct s3c2410_request	*req = 0;    	printk("s3c2410_dequeue(ep=%p,req=%p)\n", _ep, _req);	if (!the_controller->driver)		return -ESHUTDOWN;	if (!_ep || !_req)		return retval;	ep = container_of (_ep, struct s3c2410_ep, ep);	udc = container_of (ep->gadget, struct s3c2410_udc, gadget);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕av在线一区二区三区| 国产成人免费视| 一区二区三区高清| 国产精品天天摸av网| 久久久不卡影院| 欧美国产97人人爽人人喊| 国产区在线观看成人精品| 国产欧美中文在线| 国产精品高潮呻吟| 玉足女爽爽91| 午夜精品久久久久久久| 五月激情六月综合| 久久99在线观看| 懂色一区二区三区免费观看 | 91丨porny丨在线| 91原创在线视频| 欧美日韩高清一区二区三区| 欧美日韩精品专区| 精品日韩欧美一区二区| 久久只精品国产| 综合久久给合久久狠狠狠97色 | 日韩免费在线观看| 久久免费看少妇高潮| 中文字幕一区二区三中文字幕| 日韩美女精品在线| 天天色综合天天| 国产成人啪午夜精品网站男同| 成人一区在线观看| 在线一区二区视频| 日韩一区二区三区av| 亚洲国产精品高清| 五月天网站亚洲| 国产成人高清在线| 欧美理论电影在线| 国产农村妇女毛片精品久久麻豆 | 久久久91精品国产一区二区精品| 国产精品你懂的| 日本不卡一区二区| 99免费精品在线观看| 91精品国产丝袜白色高跟鞋| 久久久一区二区| 亚洲一区av在线| 国产激情精品久久久第一区二区| 欧美午夜片在线看| 国产欧美日韩麻豆91| 天堂av在线一区| 91丨porny丨首页| 久久新电视剧免费观看| 亚洲444eee在线观看| 成人免费的视频| 久久蜜桃一区二区| 日韩精品一区第一页| 99精品视频免费在线观看| 欧美www视频| 日韩国产精品91| 欧美日韩精品是欧美日韩精品| 久久久久国产精品免费免费搜索| 伊人夜夜躁av伊人久久| 国产盗摄一区二区| 日韩欧美的一区| 美腿丝袜亚洲综合| 欧美日韩mp4| 性做久久久久久久免费看| 色哟哟一区二区在线观看| 国产欧美精品国产国产专区| 美腿丝袜在线亚洲一区| 91精品国产一区二区三区| 亚洲国产日韩综合久久精品| 色综合天天性综合| 18欧美亚洲精品| 91色porny在线视频| 中文字幕在线视频一区| 国产福利一区二区三区视频在线 | 波多野结衣中文一区| 国产欧美日韩一区二区三区在线观看 | 欧美一区二区三级| 日韩av一区二| 日韩视频一区二区三区| 久久国产精品色| 久久婷婷色综合| 国产精品综合久久| 中文字幕欧美激情| av不卡在线播放| 亚洲黄色av一区| 欧美日韩精品一区二区三区四区| 亚洲r级在线视频| 日韩一级在线观看| 国产在线一区二区综合免费视频| 久久久久青草大香线综合精品| 国产一区二区三区久久久| 久久久精品天堂| 一本一道久久a久久精品 | 欧美一二三区在线观看| 蜜臀av在线播放一区二区三区| 精品国免费一区二区三区| 精品一区二区三区在线播放视频 | 国产精品久久久久久久久免费相片| 成人午夜碰碰视频| 一区二区三区精品在线观看| 欧美麻豆精品久久久久久| 久久精品久久综合| 国产三级精品视频| 色婷婷综合中文久久一本| 免费在线观看一区| 国产精品福利一区二区| 欧美视频一二三区| 国产精品夜夜嗨| 一区二区三区在线视频观看58| 日韩一区二区三区四区| 懂色av噜噜一区二区三区av| 亚洲狼人国产精品| 精品国产乱码久久久久久浪潮| av午夜精品一区二区三区| 亚洲国产精品一区二区久久恐怖片| 欧美大胆一级视频| 色av成人天堂桃色av| 九色|91porny| 亚洲自拍偷拍九九九| 精品捆绑美女sm三区| 91成人网在线| 国产不卡视频一区| 男男gaygay亚洲| 一区二区三区日韩精品视频| 久久久综合视频| 欧美精品乱码久久久久久按摩 | 色婷婷一区二区三区四区| 精品一区二区三区免费观看| 一区二区三区四区亚洲| 国产免费久久精品| 精品国产区一区| 欧美夫妻性生活| 色天天综合久久久久综合片| 韩国一区二区在线观看| 午夜电影久久久| 一卡二卡三卡日韩欧美| 国产精品青草久久| 久久久久久黄色| 精品日韩成人av| 日韩美女视频在线| 717成人午夜免费福利电影| 色综合久久88色综合天天免费| 国产高清精品在线| 国产麻豆精品在线| 国模大尺度一区二区三区| 偷拍日韩校园综合在线| 亚洲一区二区三区视频在线| 精品亚洲欧美一区| 免费一级片91| 蜜桃av一区二区三区电影| 午夜精品一区二区三区三上悠亚| 一区二区三区不卡在线观看| 悠悠色在线精品| 亚洲五月六月丁香激情| 一区二区三区电影在线播| 亚洲自拍与偷拍| 图片区小说区国产精品视频| 婷婷丁香激情综合| 午夜精品福利一区二区蜜股av | 精品国产99国产精品| 精品国产一区二区三区久久影院| 欧美一级黄色大片| 精品精品国产高清a毛片牛牛 | 欧美专区亚洲专区| 欧美又粗又大又爽| 7777精品伊人久久久大香线蕉超级流畅| 欧美日韩一区二区三区免费看| 欧美日韩激情一区二区| 56国语精品自产拍在线观看| 日韩一区二区三区视频在线观看| 日韩欧美中文字幕一区| 欧美精品一区男女天堂| 国产片一区二区三区| 国产精品色在线观看| 一区二区三区不卡在线观看 | 视频在线观看一区| 奇米色一区二区| 高清视频一区二区| 色狠狠色噜噜噜综合网| 5566中文字幕一区二区电影| 精品日韩一区二区三区免费视频| 国产精品日产欧美久久久久| 亚洲精品日韩专区silk| 蜜臀av性久久久久蜜臀aⅴ四虎 | 亚洲精品视频免费看| 日韩av午夜在线观看| 国产精品夜夜爽| 欧美性极品少妇| 日本一区二区视频在线| 亚洲图片有声小说| 国产精品123| 欧美女孩性生活视频| 久久人人超碰精品| 亚洲一区二区成人在线观看| 精品夜夜嗨av一区二区三区| 91老师国产黑色丝袜在线| 日韩你懂的在线观看| 亚洲美女屁股眼交| 国产高清在线精品| 日韩一区国产二区欧美三区| 亚洲天堂2014|