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

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

?? usb_uhci.c

?? ppcboot2.0 華恒光盤里帶的BOOTLOADER
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* * (C) Copyright 2001 * Denis Peter, MPL AG Switzerland * * See file CREDITS for list of people who contributed to this * project. * * 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 * * Note: Part of this code has been derived from linux * *//********************************************************************** * How it works: * ------------- * The framelist / Transfer descriptor / Queue Heads are similar like * in the linux usb_uhci.c. * * During initialization, the following skeleton is allocated in init_skel: * *         framespecific           |           common chain * * framelist[] * [  0 ]-----> TD ---------\ * [  1 ]-----> TD ----------> TD ------> QH -------> QH -------> QH ---> NULL *   ...        TD ---------/ * [1023]-----> TD --------/ * *              ^^             ^^         ^^          ^^          ^^ *              7 TDs for      1 TD for   Start of    Start of    End Chain *              INT (2-128ms)  1ms-INT    CTRL Chain  BULK Chain * * * Since this is a bootloader, the isochronous transfer descriptor have been removed. * * Interrupt Transfers. * -------------------- * For Interupt transfers USB_MAX_TEMP_INT_TD Transfer descriptor are available. They * will be inserted after the appropriate (depending the interval setting) skeleton TD. * If an interrupt has been detected the dev->irqhandler is called. The status and number * of transfered bytes is stored in dev->irq_status resp. dev->irq_act_len. If the * dev->irqhandler returns 0, the interrupt TD is removed and disabled. If an 1 is returned, * the interrupt TD will be reactivated. * * Control Transfers * ----------------- * Control Transfers are issued by filling the tmp_td with the appropriate data and connect * them to the qh_cntrl queue header. Before other control/bulk transfers can be issued, * the programm has to wait for completion. This does not allows asynchronous data transfer. * * Bulk Transfers * -------------- * Bulk Transfers are issued by filling the tmp_td with the appropriate data and connect * them to the qh_bulk queue header. Before other control/bulk transfers can be issued, * the programm has to wait for completion. This does not allows asynchronous data transfer. * * */#include <common.h>#include <pci.h>#ifdef CONFIG_USB_UHCI#include <usb.h>#include "usb_uhci.h"#define USB_MAX_TEMP_TD      128  /* number of temporary TDs for bulk and control transfers */#define USB_MAX_TEMP_INT_TD  32   /* number of temporary TDs for Interrupt transfers */#undef USB_UHCI_DEBUG#ifdef	USB_UHCI_DEBUG#define	USB_UHCI_PRINTF(fmt,args...)	printf (fmt ,##args)#else#define USB_UHCI_PRINTF(fmt,args...)#endifstatic int irqvec = -1;            /* irq vector, if -1 uhci is stopped / reseted */unsigned int usb_base_addr;       /* base address */static uhci_td_t td_int[8];        /* Interrupt Transfer descriptors */static uhci_qh_t qh_cntrl;         /* control Queue Head */static uhci_qh_t qh_bulk;          /*  bulk Queue Head */static uhci_qh_t qh_end;           /* end Queue Head */static uhci_td_t td_last;          /* last TD (linked with end chain) *//* temporary tds */static uhci_td_t tmp_td[USB_MAX_TEMP_TD];          /* temporary bulk/control td's  */static uhci_td_t tmp_int_td[USB_MAX_TEMP_INT_TD];  /* temporary interrupt td's  */static unsigned long framelist[1024] __attribute__ ((aligned (0x1000))); /* frame list */static struct virt_root_hub rh;   /* struct for root hub *//********************************************************************** * some forward decleration */int uhci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,						void *buffer, int transfer_len,struct devrequest *setup);/* fill a td with the approproiate data. Link, status, info and buffer * are used by the USB controller itselfes, dev is used to identify the * "connected" device */void usb_fill_td(uhci_td_t* td,unsigned long link,unsigned long status,					unsigned long info, unsigned long buffer, unsigned long dev){	td->link=swap_32(link);	td->status=swap_32(status);	td->info=swap_32(info);	td->buffer=swap_32(buffer);	td->dev_ptr=dev;}/* fill a qh with the approproiate data. Head and element are used by the USB controller * itselfes. As soon as a valid dev_ptr is filled, a td chain is connected to the qh. * Please note, that after completion of the td chain, the entry element is removed / * marked invalid by the USB controller. */void usb_fill_qh(uhci_qh_t* qh,unsigned long head,unsigned long element){	qh->head=swap_32(head);	qh->element=swap_32(element);	qh->dev_ptr=0L;}/* get the status of a td->status */unsigned long usb_uhci_td_stat(unsigned long status){	unsigned long result=0;	result |= (status & TD_CTRL_NAK)      ? USB_ST_NAK_REC : 0;	result |= (status & TD_CTRL_STALLED)  ? USB_ST_STALLED : 0;	result |= (status & TD_CTRL_DBUFERR)  ? USB_ST_BUF_ERR : 0;	result |= (status & TD_CTRL_BABBLE)   ? USB_ST_BABBLE_DET : 0;	result |= (status & TD_CTRL_CRCTIMEO) ? USB_ST_CRC_ERR : 0;	result |= (status & TD_CTRL_BITSTUFF) ? USB_ST_BIT_ERR : 0;	result |= (status & TD_CTRL_ACTIVE)   ? USB_ST_NOT_PROC : 0;	return result;}/* get the status and the transfered len of a td chain. * called from the completion handler */int usb_get_td_status(uhci_td_t *td,struct usb_device *dev){	unsigned long temp,info;	unsigned long stat;	uhci_td_t *mytd=td;	if(dev->devnum==rh.devnum)		return 0;	dev->act_len=0;	stat=0;	do {		temp=swap_32((unsigned long)mytd->status);		stat=usb_uhci_td_stat(temp);		info=swap_32((unsigned long)mytd->info);		if(((info & 0xff)!= USB_PID_SETUP) &&				(((info >> 21) & 0x7ff)!= 0x7ff) &&				(temp & 0x7FF)!=0x7ff)		{  /* if not setup and not null data pack */			dev->act_len+=(temp & 0x7FF) + 1; /* the transfered len is act_len + 1 */		}		if(stat) {           /* status no ok */			dev->status=stat;			return -1;		}		temp=swap_32((unsigned long)mytd->link);		mytd=(uhci_td_t *)(temp & 0xfffffff0);	}while((temp & 0x1)==0); /* process all TDs */	dev->status=stat;	return 0; /* Ok */}/*------------------------------------------------------------------- *                         LOW LEVEL STUFF *          assembles QHs und TDs for control, bulk and iso *-------------------------------------------------------------------*//* Submits a control message. That is a Setup, Data and Status transfer. * Routine does not wait for completion. */int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,										int transfer_len,struct devrequest *setup){	unsigned long destination, status;	int maxsze = usb_maxpacket(dev, pipe);	unsigned long dataptr;	int len;	int pktsze;	int i=0;	if (!maxsze) {		USB_UHCI_PRINTF("uhci_submit_control_urb: pipesize for pipe %lx is zero\n", pipe);		return -1;	}	if(((pipe>>8)&0x7f)==rh.devnum) {		/* this is the root hub -> redirect it */		return uhci_submit_rh_msg(dev,pipe,buffer,transfer_len,setup);	}	USB_UHCI_PRINTF("uhci_submit_control start len %x, maxsize %x\n",transfer_len,maxsze);	/* The "pipe" thing contains the destination in bits 8--18 */	destination = (pipe & PIPE_DEVEP_MASK) | USB_PID_SETUP; /* Setup stage */	/* 3 errors */	status = (pipe & TD_CTRL_LS) | TD_CTRL_ACTIVE | (3 << 27);	/* (urb->transfer_flags & USB_DISABLE_SPD ? 0 : TD_CTRL_SPD); */	/*  Build the TD for the control request, try forever, 8 bytes of data */	usb_fill_td(&tmp_td[i],UHCI_PTR_TERM ,status, destination | (7 << 21),(unsigned long)setup,(unsigned long)dev);#if 0	{		char *sp=(char *)setup;		printf("SETUP to pipe %lx: %x %x %x %x %x %x %x %x\n", pipe,		    sp[0],sp[1],sp[2],sp[3],sp[4],sp[5],sp[6],sp[7]);	}#endif	dataptr = (unsigned long)buffer;	len=transfer_len;	/* If direction is "send", change the frame from SETUP (0x2D)	   to OUT (0xE1). Else change it from SETUP to IN (0x69). */	destination = (pipe & PIPE_DEVEP_MASK) | ((pipe & USB_DIR_IN)==0 ? USB_PID_OUT : USB_PID_IN);	while (len > 0) {		/* data stage */		pktsze = len;		i++;		if (pktsze > maxsze)			pktsze = maxsze;		destination ^= 1 << TD_TOKEN_TOGGLE;	/* toggle DATA0/1 */		usb_fill_td(&tmp_td[i],UHCI_PTR_TERM, status, destination | ((pktsze - 1) << 21),dataptr,(unsigned long)dev);	/* Status, pktsze bytes of data */		tmp_td[i-1].link=swap_32((unsigned long)&tmp_td[i]);		dataptr += pktsze;		len -= pktsze;	}	/*  Build the final TD for control status */	/* It's only IN if the pipe is out AND we aren't expecting data */	destination &= ~UHCI_PID;	if (((pipe & USB_DIR_IN)==0) || (transfer_len == 0))		destination |= USB_PID_IN;	else		destination |= USB_PID_OUT;	destination |= 1 << TD_TOKEN_TOGGLE;	/* End in Data1 */	i++;	status &=~TD_CTRL_SPD;	/* no limit on errors on final packet , 0 bytes of data */	usb_fill_td(&tmp_td[i],UHCI_PTR_TERM, status | TD_CTRL_IOC, destination | (UHCI_NULL_DATA_SIZE << 21),0,(unsigned long)dev);	tmp_td[i-1].link=swap_32((unsigned long)&tmp_td[i]);	/* queue status td */	/*	usb_show_td(i+1);*/	USB_UHCI_PRINTF("uhci_submit_control end (%d tmp_tds used)\n",i);	/* first mark the control QH element terminated */	qh_cntrl.element=0xffffffffL;	/* set qh active */	qh_cntrl.dev_ptr=(unsigned long)dev;	/* fill in tmp_td_chain */	qh_cntrl.element=swap_32((unsigned long)&tmp_td[0]);	return 0;}/*------------------------------------------------------------------- * Prepare TDs for bulk transfers. */int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,int transfer_len){	unsigned long destination, status,info;	unsigned long dataptr;	int maxsze = usb_maxpacket(dev, pipe);	int len;	int i=0;	if(transfer_len < 0) {		printf("Negative transfer length in submit_bulk\n");		return -1;	}	if (!maxsze)		return -1;	/* The "pipe" thing contains the destination in bits 8--18. */	destination = (pipe & PIPE_DEVEP_MASK) | usb_packetid (pipe);	/* 3 errors */	status = (pipe & TD_CTRL_LS) | TD_CTRL_ACTIVE | (3 << 27);	/*	((urb->transfer_flags & USB_DISABLE_SPD) ? 0 : TD_CTRL_SPD) | (3 << 27); */	/* Build the TDs for the bulk request */	len = transfer_len;	dataptr = (unsigned long)buffer;	do {		int pktsze = len;		if (pktsze > maxsze)			pktsze = maxsze;		/* pktsze bytes of data  */		info = destination | (((pktsze - 1)&UHCI_NULL_DATA_SIZE) << 21) |			(usb_gettoggle (dev, usb_pipeendpoint (pipe), usb_pipeout (pipe)) << TD_TOKEN_TOGGLE);		if((len-pktsze)==0)			status |= TD_CTRL_IOC;	/* last one generates INT */		usb_fill_td(&tmp_td[i],UHCI_PTR_TERM, status, info,dataptr,(unsigned long)dev);	/* Status, pktsze bytes of data */		if(i>0)			tmp_td[i-1].link=swap_32((unsigned long)&tmp_td[i]);		i++;		dataptr += pktsze;		len -= pktsze;		usb_dotoggle (dev, usb_pipeendpoint (pipe), usb_pipeout (pipe));	} while (len > 0);	/* first mark the bulk QH element terminated */	qh_bulk.element=0xffffffffL;	/* set qh active */	qh_bulk.dev_ptr=(unsigned long)dev;	/* fill in tmp_td_chain */	qh_bulk.element=swap_32((unsigned long)&tmp_td[0]);	return 0;}/* search a free interrupt td */uhci_td_t *uhci_alloc_int_td(void){	int i;	for(i=0;i<USB_MAX_TEMP_INT_TD;i++) {		if(tmp_int_td[i].dev_ptr==0) /* no device assigned -> free TD */			return &tmp_int_td[i];	}	return NULL;}#if 0void uhci_show_temp_int_td(void){	int i;	for(i=0;i<USB_MAX_TEMP_INT_TD;i++) {		if((tmp_int_td[i].dev_ptr&0x01)!=0x1L) /* no device assigned -> free TD */			printf("temp_td %d is assigned to dev %lx\n",i,tmp_int_td[i].dev_ptr);	}	printf("all others temp_tds are free\n");}#endif/*------------------------------------------------------------------- * submits USB interrupt (ie. polling ;-) */int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,int transfer_len, int interval){	int nint, n;	unsigned long status, destination;	unsigned long info,tmp;	uhci_td_t *mytd;	if (interval < 0 || interval >= 256)		return -1;	if (interval == 0)		nint = 0;	else {		for (nint = 0, n = 1; nint <= 8; nint++, n += n)	/* round interval down to 2^n */		 {			if(interval < n) {				interval = n / 2;				break;			}		}		nint--;	}	USB_UHCI_PRINTF("Rounded interval to %i, chain  %i\n", interval, nint);	mytd=uhci_alloc_int_td();	if(mytd==NULL) {		printf("No free INT TDs found\n");

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一卡二卡在线观看| 一区二区三区在线视频免费| 国产精品入口麻豆九色| 亚洲在线视频网站| 国产精品一区二区久激情瑜伽| 欧美性大战久久久久久久| 国产欧美一区二区精品忘忧草 | 色综合一个色综合亚洲| 日韩欧美一级二级三级| 亚洲图片欧美综合| 91丝袜美腿高跟国产极品老师 | 成人午夜精品在线| 日韩亚洲欧美高清| 午夜伦欧美伦电影理论片| 91小视频免费看| 国产女主播一区| 国产风韵犹存在线视精品| 宅男在线国产精品| 亚洲自拍另类综合| 91免费观看视频| 国产精品福利av| 99久久精品国产网站| 欧美国产日本韩| 国产99精品视频| 欧美激情一区不卡| 国产精品1区2区3区在线观看| 欧美videos大乳护士334| 美女视频网站久久| 欧美xxxx在线观看| 国产福利电影一区二区三区| 欧美精品一区二区三| 狠狠色伊人亚洲综合成人| 精品成人一区二区三区| 经典一区二区三区| 亚洲精品在线电影| 福利电影一区二区| 国产精品久久久一本精品 | 亚洲国产欧美在线| 精品视频999| 亚洲18影院在线观看| 宅男噜噜噜66一区二区66| 美腿丝袜亚洲综合| 久久蜜桃一区二区| 成人avav影音| 亚洲资源中文字幕| 日韩午夜精品电影| 国产乱子轮精品视频| 中文字幕高清一区| 91成人免费在线视频| 日韩专区一卡二卡| 久久久久国产精品免费免费搜索| 丰满少妇久久久久久久| 亚洲精选视频免费看| 欧美日韩成人高清| 国产一本一道久久香蕉| 中文字幕在线不卡视频| 欧美猛男超大videosgay| 久久91精品久久久久久秒播| 欧美激情一区二区在线| 欧美亚洲国产怡红院影院| 免费人成黄页网站在线一区二区| 久久久精品人体av艺术| 色哟哟一区二区| 美日韩一区二区| 亚洲欧美激情小说另类| 欧美一区二区三区婷婷月色| 成人黄色电影在线 | 国产.精品.日韩.另类.中文.在线.播放| 国产精品三级在线观看| 欧美精品一二三| 成人性生交大片| 日本伊人色综合网| 亚洲少妇最新在线视频| 精品理论电影在线| 一本久久a久久精品亚洲| 久久成人免费网站| 亚洲一区精品在线| 久久先锋资源网| 在线一区二区三区四区| 国产69精品一区二区亚洲孕妇| 亚洲国产视频网站| 国产精品久久久久一区二区三区 | 欧美亚洲动漫精品| 欧美伊人久久大香线蕉综合69| 国产一区二区三区在线看麻豆| 一级精品视频在线观看宜春院| 久久久精品黄色| 欧美一区二区三区小说| 欧美在线不卡一区| av一本久道久久综合久久鬼色| 日本色综合中文字幕| 亚洲女厕所小便bbb| 中文字幕巨乱亚洲| 久久综合久久鬼色中文字| 欧美日韩的一区二区| 色婷婷久久久久swag精品| 成年人午夜久久久| 风间由美一区二区三区在线观看 | 国产一区二区女| 免费在线观看一区| 天天影视涩香欲综合网| 亚洲制服丝袜一区| 亚洲日本中文字幕区| 国产精品久久久久婷婷二区次| 久久综合久久99| 亚洲精品一区二区三区精华液| 欧美一区二区三区不卡| 欧美一区二区视频在线观看| 91 com成人网| 欧美一二区视频| 日韩欧美国产一区二区三区| 欧美一区二区视频在线观看2022 | 蜜臀国产一区二区三区在线播放| 亚洲宅男天堂在线观看无病毒| 亚洲色大成网站www久久九九| 国产精品九色蝌蚪自拍| 国产精品国产三级国产aⅴ原创| 国产精品乱码人人做人人爱| 国产精品无码永久免费888| 国产精品福利一区| 亚洲亚洲人成综合网络| 午夜精品视频在线观看| 秋霞午夜av一区二区三区| 久久99精品久久久久久动态图| 精品一区二区三区不卡| 国产成人三级在线观看| 91麻豆国产精品久久| 欧美日韩一区二区不卡| 日韩欧美在线123| 久久久美女艺术照精彩视频福利播放| 国产亚洲精品资源在线26u| 国产精品久久久久久久久果冻传媒| 国产精品久久久久久久久久久免费看 | 亚洲人成小说网站色在线| 一区二区三区国产| 奇米四色…亚洲| 国产高清精品久久久久| 欧美中文字幕亚洲一区二区va在线| 欧美日韩激情在线| 久久久国产精品麻豆| 亚洲天堂网中文字| 日本亚洲天堂网| 成人黄色片在线观看| 欧美猛男超大videosgay| 久久久国产一区二区三区四区小说 | 欧美亚洲国产bt| 精品日韩一区二区三区| 最近中文字幕一区二区三区| 丝袜美腿成人在线| 国产成人av自拍| 欧美日韩精品高清| 国产精品免费av| 日本不卡视频一二三区| av一区二区久久| 日韩精品最新网址| 亚洲人成精品久久久久久| 奇米影视一区二区三区| 97成人超碰视| 久久夜色精品国产噜噜av| 亚洲电影第三页| caoporn国产精品| 日韩欧美国产综合| 亚洲国产色一区| eeuss影院一区二区三区| 精品国产乱码久久久久久图片| 一区二区三区在线视频免费| 国产精品一区二区你懂的| 欧美丰满少妇xxxbbb| 亚洲色图制服诱惑| 国产在线一区二区综合免费视频| 欧美主播一区二区三区| 中文字幕一区不卡| 国产精品1024| 欧美成va人片在线观看| 亚洲第一主播视频| 色婷婷综合久久久久中文 | 欧美变态tickling挠脚心| 亚洲综合色丁香婷婷六月图片| 粉嫩av亚洲一区二区图片| 精品免费日韩av| 秋霞电影网一区二区| 精品视频在线免费观看| 一区二区三区免费| www.欧美色图| 欧美高清在线一区| 粉嫩aⅴ一区二区三区四区| 久久久不卡网国产精品一区| 九九热在线视频观看这里只有精品| 欧美精品精品一区| 午夜av一区二区三区| 欧美日韩综合一区| 亚洲一二三四区| 精品视频在线免费观看| 午夜精品国产更新| 欧美日韩国产一二三| 天天操天天色综合| 欧美一区二区在线播放| 久久精品国产一区二区三 | 一区二区三区在线视频免费观看| 99久久99久久精品国产片果冻|