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

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

?? usbdcorelib.c

?? 基于VXWORK環境的ARM9 S2410的USB驅動程序
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* usbdCoreLib.c - USBD core logic *//* Copyright 2000-2002 Wind River Systems, Inc. *//*Modification history--------------------01l,08nov01,wef  USBD_NODE struture element changed from hubStatus to 		 pHubStatus, reflect this change01k,25oct01,wef  repalce automatic buffer creations with calls to OSS_MALLOC		 in places where the buffer is passed to the hardware (related 		 to SPR 70492).01j,18sep01,wef  merge from wrs.tor2_0.usb1_1-f for veloce01i,08aug01,dat  Removing warnings01h,12aug00,bri  Modify interrogateDeviceClass() to 		 1. Allow multifunction devices that belong to same USB class		    but have interfaces belonging to different subclasses.		 2. Store the configuration Value as mentioned in the 		    configuration descriptor in the nodeClass.		 3. Ensure nodeclasses are created for all devices.01g,20mar00,rcb  Add USB_DEVICE_DESCR field to USBD_NODE.01f,17jan00,rcb  Modify interrogateDeviceClass() to use usbConfigDescrGet()...		 ensures that all descriptors associated with a configuration		 descriptor will be read, even if the total length is very long.01e,20dec99,rcb  Fix benign bug in fncConfigSet() regarding pRoot.		 Fix benign bug in HCD detach logic which detached the HCD		 before deleting all pipes.01d,23nov99,rcb  Replace HCD bandwidth alloc/release with pipe create/destroy		 in order to generalize approach for OHCI HCD.01c,24sep99,rcb  Change packet count calculation in transferIrpCallback()		 to handle case where a single 0-length packet is transferred.01b,07sep99,rcb  Add support for management callbacks and set-bus-state API.01a,08jun99,rcb  First.*//*DESCRIPTIONThis module contains the primary USBD entry point, usbdUrbExec() and theindividual USBD function execution routines.  usbdUrbExec() is responsible for interpreting each URB's function code and then fanning-out to the individual function processor.  IMPLEMENTATION NOTESWhen the USBD is first initialized it creates an internal "client" which is used by the USBD when performing control pipe transfers to each hub/device.  This"client" remains active until the USBD is shut down.For each client registered with the USBD, including the internal client, the USBDallocates an individual task, and that task inherits the priority of the clienttask which invokes the usbdClientRegister() function.  This task is normally inactive, and only wakes up when a client callback is to be executed.  Therefore, each client's callbacks are invoked on a task which is unique to that client.Other USBD tasks (see below) are therefore shielded from the behavoir of anindividual client's callback routine.For each USB which is attached to the USBD through the usbdHcdAttach() function,the USBD also creates a unique "bus monitor" task.  This task is responsiblefor configuring and monitoring each hub on a given USB.  Whenever a hub or deviceis attached/removed from the USB, the bus monitor thread is responsible forupdating internal data structures, configuring/re-configuring hubs, and fortriggering "dynamic attach/removal" callbacks - which themselves are performed byeach individual client's callback task.All USBD internal data structures, e.g., client lists, HCD lists and releatednode structures, are protected by a single mutex, structMutex.	All threads whichrely on the stability of internal data structures or which can modify internaldata structures take this mutex.  usbdCoreEntry() is the single entry pointresponsible for taking this mutex when clients invoke the USBD.  Each "busmonitor" thread also takes this mutex each time it may update bus structures.  IRP callback, however, do not take the mutex.  While certain IRP "userPtr" fieldsmay point to other USBD structures, the organization of the code guarantees thatIRPs will be completed or canceled prior to dismantling the USBD structures withwhich they are associated.*//* defines */#define USBD_VERSION	0x0001			    /* USBD version in BCD */#define USBD_MFG	"Wind River Systems, Inc."  /* USBD Mfg */#define INTERNAL_CLIENT_NAME	"usbd"/* includes */#include "usb/usbPlatform.h"#include "string.h"#include "usb/ossLib.h"#include "usb/usbQueueLib.h"#include "usb/usbLib.h" 	/* USB utility functions */#include "usb/usbdCoreLib.h"	/* our API */#include "drv/usb/usbHcd.h"	/* HCD interface */#include "usb/usbHcdLib.h"	/* HCD function library */#include "usb/usbdStructures.h" /* usbdCoreLib data structures */#include "s3c2410.h"/* defines */#define PENDING 		1#define CALLBACK_Q_DEPTH	128	/* Needs to be fairly deep to handle */					/* a potentially large number of */					/* notification callbacks */#define BUS_Q_DEPTH		32	/* Outstanding bus service requests *//* clientThread request codes...stored in msg field of OSS_MESSAGE. */#define CALLBACK_FNC_TERMINATE	    0	/* Terminate the callback thread */#define CALLBACK_FNC_IRP_COMPLETE   1	/* issue an IRP completion callback */#define CALLBACK_FNC_NOTIFY_ATTACH  2	/* issue an attach callback */#define CALLBACK_FNC_MNGMT_EVENT    3	/* management event callback */#define CALLBACK_TIMEOUT	5000	/* Wait 5 seconds for callback to */					/* exit in response to terminate fnc *//* busThread request codes...stored in msg field of OSS_MESSAGE. */#define BUS_FNC_TERMINATE	0	/* Terminate the bus monitor thread */#define BUS_FNC_UPDATE_HUB	1	/* update a hub */#define BUS_TIMEOUT		5000	/* Wait 5 seconds for bus monitor */					/* thread to terminate *//* general timeout */#define IO_TIMEOUT		5000	/* 5 seconds */#define EXCLUSION_TIMEOUT	10000	/* 10 seconds *//* HUB_STATUS_LEN() returns length of status structure for indicated hub node */#define HUB_STATUS_LEN(pNode)	\    min ((pNode->numPorts + 1 + 7) / 8, (int) MAX_HUB_STATUS_LEN)/* Constants used by resetDataToggle(). */#define ANY_CONFIGURATION	0xffff#define ANY_INTERFACE		0xffff#define ANY_ENDPOINT		0xffff/* typedefs *//* NOTIFICATION *  * Created by notifyIfMatch() and consumed by client's callback thread. */typedef struct notification    {    USBD_ATTACH_CALLBACK callback;	/* client's callback routine */    USBD_NODE_ID nodeId;		/* node being attached/removed */    UINT16 attachCode;			/* attach code */    UINT16 configuration;		/* config matching notify request */    UINT16 interface;			/* interface matching notify request */    UINT16 deviceClass; 		/* device/interface class */    UINT16 deviceSubClass;		/* device/interface sub class */    UINT16 deviceProtocol;		/* device/interface protcol */    } NOTIFICATION, *pNOTIFICATION;/* locals */LOCAL int initCount = 0;LOCAL MUTEX_HANDLE structMutex = NULL;	/* guards USBD structures */LOCAL LIST_HEAD hcdList = {0};		/* List of attached HCDs */LOCAL LIST_HEAD clientList = {0};	/* list of registered clients */LOCAL USBD_CLIENT_HANDLE internalClient = NULL; /* internal client *//* forward declarations */LOCAL BOOL initHubIrp    (    pUSBD_NODE pNode    );LOCAL pUSBD_NODE createNode     (    pUSBD_BUS pBus,		    /* node's parent bus */    USBD_NODE_ID rootId,	    /* root id */    USBD_NODE_ID parentHubId,	    /* parent hub id */    UINT16 parentHubPort,	    /* parent hub port no */    UINT16 nodeSpeed,		    /* node speed */    UINT16 topologyDepth	    /* this node's depth in topology */    );/* functions *//***************************************************************************** validateClient - Determines if a client handle is valid** RETURNS: TRUE if client valid, else FALSE*/LOCAL BOOL validateClient    (    USBD_CLIENT_HANDLE clientHandle,	/* client to be validated */    pUSBD_CLIENT *ppClient		/* ptr to USBD_CLIENT if valid */    )    {    if (usbHandleValidate (clientHandle, USBD_CLIENT_SIG, (pVOID *) ppClient) 	!= OK)	return FALSE;    return TRUE;    }/***************************************************************************** validateNode - Determines if a node handle is valid** RETURNS: TRUE if node valid, else FALSE*/LOCAL BOOL validateNode    (    USBD_NODE_ID nodeId,	    /* Node to be validated */    pUSBD_NODE *ppNode		    /* ptr to USBD_NODE if valid */    )    {    if (usbHandleValidate (nodeId, USBD_NODE_SIG, (pVOID *) ppNode) != OK ||	(*ppNode)->nodeDeletePending)	return FALSE;    return TRUE;    }/***************************************************************************** validatePipe - Determines if a pipe is valid** RETURNS: TRUE if pipe valid, else FALSE*/LOCAL BOOL validatePipe    (    USBD_PIPE_HANDLE pipeHandle,    /* pipe to be validated */    pUSBD_PIPE *ppPipe		    /* ptr to USBD_PIPE if valid */    )    {    if (usbHandleValidate (pipeHandle, USBD_PIPE_SIG, (pVOID *) ppPipe) != OK ||	(*ppPipe)->pipeDeletePending || (*ppPipe)->pNode->nodeDeletePending)	return FALSE;    return TRUE;    }/***************************************************************************** validateUrb - Performs validation checks on URB** Checks the URB length set in the URB_HEADER against the <expectedLen>* passed by the caller.  If <pClient> is not NULL, also attempts to* validate the USBD_CLIENT_HANDLE.  If successful, stores the client* handle in <pClient>** RETURNS: S_usbdLib_xxxx*/LOCAL int validateUrb    (    pVOID pUrb,    UINT16 expectedLen,    pUSBD_CLIENT *ppClient    )    {    pURB_HEADER pHeader = (pURB_HEADER) pUrb;    if (initCount == 0)	return S_usbdLib_NOT_INITIALIZED;    if (pHeader->urbLength != expectedLen)	return S_usbdLib_BAD_PARAM;    if (ppClient != NULL)	{	if (!validateClient (pHeader->handle, ppClient))	    {	    return S_usbdLib_BAD_HANDLE;	    }	}    return OK;    }/***************************************************************************** setUrbResult - Sets URB_HEADER.status and .result fields** Based on the <result> parameter passed by the caller, set the * status and result fields in the URB_HEADER of <pUrb>. ** RETURNS: Value of <result> parameter*/LOCAL int setUrbResult    (    pURB_HEADER pUrb,		/* Completed URB */    int result			/* S_usbdLib_xxxx code */    )    {    if (result != PENDING)	{	pUrb->result = result;	if (pUrb->callback != NULL)	    (*pUrb->callback) (pUrb);	}    return result;    }/***************************************************************************** doShutdown - Shut down USBD core lib** RETURNS: N/A*/LOCAL VOID doShutdown (void)    {    /* unregister any clients which may still be registered */    pUSBD_CLIENT pClient;    pUSBD_HCD pHcd;    while ((pClient = usbListFirst (&clientList)) != NULL)	usbdClientUnregister (pClient->handle);    /* detach any HCDs which may still be attached */    while ((pHcd = usbListFirst (&hcdList)) != NULL)	usbdHcdDetach (pHcd->attachToken);    /* release the structure guard mutex */    if (structMutex != NULL)	{	OSS_MUTEX_DESTROY (structMutex);	structMutex = NULL;	}    /* Shut down libraries */    usbHandleShutdown ();    ossShutdown ();    }/***************************************************************************** fncInitialize - Initialize USBD** RETURNS: S_usbdLib_xxxx*/LOCAL int fncInitialize    (    pURB_HEADER pUrb    )    {    int s = OK;    if (initCount == 0)	{	/* Initialize the osServices library */	if (ossInitialize () != OK)	    return S_usbdLib_GENERAL_FAULT;	if (usbHandleInitialize (0 /* use default */) != OK)	    {	    ossShutdown ();	    return S_usbdLib_GENERAL_FAULT;	    }    	++initCount;	/* Initialize the lists of HCDs and clients */	if (OSS_MUTEX_CREATE (&structMutex) != OK)	    s = S_usbdLib_OUT_OF_RESOURCES;	memset (&hcdList, 0, sizeof (hcdList));	memset (&clientList, 0, sizeof (clientList));	}    if (s == OK)	{	/* Register an internal client for hub I/O, etc. */	internalClient = NULL;	if (usbdClientRegister (INTERNAL_CLIENT_NAME, &internalClient) != OK)	    s = S_usbdLib_GENERAL_FAULT;	}    if (s != OK)	{	doShutdown ();	initCount = 0;	}    return s;    }/***************************************************************************** fncShutdown - Shuts down USBD** RETURNS: S_usbdLib_xxxx*/LOCAL int fncShutdown    (    pURB_HEADER pUrb    )    {    int s;    /* validate URB */    if ((s = validateUrb (pUrb, sizeof (*pUrb), NULL)) != OK)	return s;    if (initCount == 1)	doShutdown ();    --initCount;    return s;    }/***************************************************************************** clientThread - client callback thread** A separate clientThread() thread is spawned for each registered* client.  This thread is responsible for invoking client callback* routines.  Using a separate callback thread for each client helps to* ensure that one client's behavior (such as blocking) won't affect the* throughput of other client requests.** By convention, the <param> is a pointer to the USBD_CLIENT structure* for the associated client.  This thread waits on the callback queue* in the client structure.  At the time this thread is first created,* the USBD_CLIENT structure is only guaranteed to have an initialized* queue...other fields may not yet be initialized.** NOTE: This thread does not need to take the structMutex.  The mainline* code ensures that the clientThread() for a given USBD_CLIENT is* terminated prior to dismantling the USBD_CLIENT structure.** RETURNS: N/A*/LOCAL VOID clientThread    (    pVOID param 		    /* thread parameter */    )    {    pUSBD_CLIENT pClient = (pUSBD_CLIENT) param;    USB_MESSAGE msg;    pUSB_IRP pIrp;    pNOTIFICATION pNotification;        /* Execute messages from the callbackQueue until a CLIENT_FNC_TERMINATE    message is received. */    do	{	if (usbQueueGet (pClient->callbackQueue, &msg, OSS_BLOCK) != OK)	    break;	switch (msg.msg)	    {	    case CALLBACK_FNC_IRP_COMPLETE:		/* invoke a client's IRP callback routine.  The msg.lParam		 * is a pointer to the completed USB_IRP.		 */		pIrp = (pUSB_IRP) msg.lParam;		if (pIrp->userCallback != NULL)		    (*pIrp->userCallback) (pIrp);		break;	    case CALLBACK_FNC_NOTIFY_ATTACH:		/* invoke a client's dynamic attach routine.  The msg.lParam		 * is a pointer to a NOTIFICATION structure.  		 *		 * NOTE: We dispose of the NOTIFICATION request after		 * consuming it.		 */		pNotification = (pNOTIFICATION) msg.lParam;		(*pNotification->callback) (pNotification->nodeId, 		    pNotification->attachCode, pNotification->configuration, 		    pNotification->interface, pNotification->deviceClass, 		    pNotification->deviceSubClass, 		    pNotification->deviceProtocol);		OSS_FREE (pNotification);		break;    	    case CALLBACK_FNC_MNGMT_EVENT:		/* invoke a client's managment callback routine.  The 		 * msg.wParam is the management code and the msg.lParam is		 * the USBD_NODE_ID of the root for the affected bus.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产视频一区在线播放| 欧美在线你懂的| 久久精品国产澳门| 午夜a成v人精品| 亚洲成在人线在线播放| 亚洲mv在线观看| 午夜精品aaa| 日本不卡一区二区三区高清视频| 天堂在线一区二区| 日本aⅴ亚洲精品中文乱码| 蜜桃av一区二区三区电影| 蜜臀av性久久久久蜜臀av麻豆 | 久久九九99视频| 国产午夜亚洲精品不卡| 国产精品黄色在线观看| 亚洲精品视频观看| 视频一区中文字幕| 国产真实乱对白精彩久久| 国产福利一区二区三区在线视频| 成人免费视频caoporn| 91麻豆123| 日韩欧美一区在线| 国产精品免费人成网站| 一区二区理论电影在线观看| 轻轻草成人在线| 丁香天五香天堂综合| 在线看不卡av| 久久久久久久综合色一本| 亚洲国产成人午夜在线一区| 日韩久久一区二区| 美女高潮久久久| 91影视在线播放| 日韩免费在线观看| 亚洲欧洲www| 九色porny丨国产精品| 99热国产精品| 精品久久人人做人人爱| 亚洲美女淫视频| 美国十次了思思久久精品导航| 夫妻av一区二区| 欧美一区二区三区在线看| 国产欧美日韩在线视频| 丝袜诱惑亚洲看片| 99精品桃花视频在线观看| 5566中文字幕一区二区电影| 国产精品网站在线| 久久精品国产色蜜蜜麻豆| 91福利在线免费观看| 久久精品一区二区| 蜜桃av噜噜一区二区三区小说| 99在线精品免费| 久久精品视频免费| 日日骚欧美日韩| 在线观看亚洲精品| 国产精品色婷婷| 国产一区视频导航| 日韩欧美国产不卡| 日韩精品1区2区3区| 色国产精品一区在线观看| 国产精品欧美一级免费| 国产麻豆视频精品| 精品国产一区二区亚洲人成毛片| 五月天丁香久久| 91成人国产精品| 一区二区激情小说| 色天使久久综合网天天| 国产精品福利影院| bt欧美亚洲午夜电影天堂| 久久久午夜精品| 国产精品一区二区不卡| 日韩欧美一级二级| 免费人成精品欧美精品| 91精品免费观看| 日本欧美一区二区三区乱码| 欧美日韩中文字幕一区二区| 亚洲国产精品久久不卡毛片| 91国偷自产一区二区三区成为亚洲经典 | 中文字幕在线观看一区二区| 国产+成+人+亚洲欧洲自线| 国产日韩欧美a| 成人激情午夜影院| 中文字幕一区二区三区色视频 | 欧美日韩在线精品一区二区三区激情| 亚洲色图一区二区三区| 在线欧美一区二区| 亚洲不卡av一区二区三区| 欧美日韩一二三区| 欧美aⅴ一区二区三区视频| 欧美一级二级在线观看| 韩国毛片一区二区三区| 中文字幕亚洲在| 欧美三级一区二区| 男人的天堂久久精品| 26uuu久久综合| 波多野结衣精品在线| 一区二区三区在线视频免费观看| 欧美日韩色综合| 麻豆freexxxx性91精品| 国产午夜一区二区三区| 色悠悠久久综合| 精品午夜一区二区三区在线观看| 国产亚洲精品bt天堂精选| 91搞黄在线观看| 国产在线精品一区二区不卡了 | 欧美日韩高清不卡| 久久福利资源站| 18成人在线视频| 在线不卡免费欧美| 成人午夜视频在线| 日韩在线a电影| 国产精品午夜在线观看| 欧美高清精品3d| 成人性视频免费网站| 首页国产欧美日韩丝袜| 国产精品丝袜在线| 日韩一区二区三区电影| 91色综合久久久久婷婷| 国产自产v一区二区三区c| 一区二区三区中文免费| 国产欧美综合在线观看第十页| 欧美制服丝袜第一页| 国产成人av电影在线| 美女尤物国产一区| 亚洲精品欧美在线| 国产精品免费久久久久| 欧美精品一区二| 欧美一区二区日韩| 欧美色图天堂网| 9色porny自拍视频一区二区| 久久91精品久久久久久秒播 | 欧美一区二区精品在线| 在线看国产一区| 91视频在线看| 成人av中文字幕| 国产精品一区二区在线播放| 久久er精品视频| 日本成人在线网站| 首页国产丝袜综合| 亚洲国产精品精华液网站| 亚洲人成亚洲人成在线观看图片| 欧美国产精品一区二区| 久久久久国产免费免费| 日韩欧美卡一卡二| 国产99一区视频免费| 日本伊人色综合网| 欧美剧情片在线观看| 不卡的av电影在线观看| 国产成人精品免费| 国产精品亚洲视频| 狠狠色丁香婷综合久久| 久久疯狂做爰流白浆xx| 理论电影国产精品| 狠狠久久亚洲欧美| 韩国午夜理伦三级不卡影院| 精品中文av资源站在线观看| 免费不卡在线观看| 激情伊人五月天久久综合| 久久99精品国产麻豆婷婷| 精品在线一区二区三区| 国内精品免费**视频| 国产夫妻精品视频| 成人性生交大片免费看视频在线| www.成人在线| 欧美性猛交xxxxxx富婆| 欧美挠脚心视频网站| 日韩欧美精品在线| 久久这里只有精品首页| 国产精品色在线| 一区二区欧美国产| 蜜桃视频免费观看一区| 国产成人综合自拍| 波多野结衣视频一区| 欧美日韩一区高清| 日韩精品一区二区三区中文精品 | 91亚洲精品久久久蜜桃| 91久久精品日日躁夜夜躁欧美| 欧美日韩大陆在线| 精品国产精品网麻豆系列| 国产精品欧美一区二区三区| 亚洲第一二三四区| 极品少妇一区二区| 一本一本大道香蕉久在线精品| 欧美日韩一区视频| 中文天堂在线一区| 午夜视频在线观看一区| 国产精品一区二区在线观看不卡| 色先锋资源久久综合| 欧美成人性战久久| 亚洲另类中文字| 精品一区二区免费| 91国产丝袜在线播放| 久久久噜噜噜久久中文字幕色伊伊 | 粉嫩在线一区二区三区视频| 欧美在线视频全部完| 国产人久久人人人人爽| 午夜影视日本亚洲欧洲精品| 成人深夜福利app| 欧美精品一区二区三区在线| 一区二区三区不卡视频| 丁香另类激情小说|