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

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

?? usbdcorelib.c

?? Vxworks5.5的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 *//* 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一区二区三区免费野_久草精品视频
欧美另类高清zo欧美| 综合婷婷亚洲小说| 亚洲男人的天堂在线观看| 久久国产尿小便嘘嘘尿| 91香蕉视频在线| 久久精品视频一区| 免费欧美日韩国产三级电影| 日本精品视频一区二区| 国产夜色精品一区二区av| 日本欧美一区二区在线观看| 日本高清不卡一区| 亚洲乱码日产精品bd| 成人免费看视频| 国产日韩视频一区二区三区| 国产伦精品一区二区三区免费| 欧美丰满少妇xxxbbb| 亚洲高清免费观看高清完整版在线观看 | 亚洲一区二区在线观看视频| 成人在线综合网| 国产网站一区二区| 高清在线成人网| 中文字幕久久午夜不卡| 国产成人综合亚洲91猫咪| 精品久久久久香蕉网| 精品一区二区三区免费| 亚洲精品在线观看视频| 国产在线视频一区二区三区| 精品国精品国产尤物美女| 狠狠色丁香久久婷婷综合_中| 日韩免费高清av| 国产一区免费电影| 久久午夜羞羞影院免费观看| 激情图片小说一区| 国产欧美一区视频| www.一区二区| 亚洲精品中文字幕乱码三区| 欧美在线短视频| 日本欧洲一区二区| 久久久久久久久久久黄色| 国产91丝袜在线18| 综合久久国产九一剧情麻豆| 色欲综合视频天天天| 伊人婷婷欧美激情| 在线播放91灌醉迷j高跟美女| 日韩国产欧美三级| 精品国产麻豆免费人成网站| 国产成人在线色| 一区二区三区丝袜| 欧美一区二区视频在线观看 | 美女在线视频一区| 精品成人一区二区三区四区| 成人av网址在线观看| 亚洲人成精品久久久久| 欧美日韩久久一区| 国产在线精品国自产拍免费| 亚洲人成人一区二区在线观看| 欧美日韩1234| 国产美女精品人人做人人爽| 国产精品久久福利| 777午夜精品免费视频| 国产精品综合二区| 亚洲午夜精品久久久久久久久| 日韩欧美你懂的| 色哟哟欧美精品| 久久疯狂做爰流白浆xx| 亚洲女与黑人做爰| 精品成人一区二区三区| 欧美中文字幕一区二区三区| 激情六月婷婷久久| 亚洲福利一区二区| 欧美激情在线一区二区三区| 欧美日本乱大交xxxxx| 成人性生交大片免费| 日本系列欧美系列| 亚洲欧美一区二区三区极速播放| 日韩欧美精品在线| 在线观看视频91| 成人精品视频.| 蜜桃视频第一区免费观看| 亚洲欧美国产毛片在线| 久久综合九色综合久久久精品综合| 欧美中文字幕亚洲一区二区va在线 | 色中色一区二区| 欧美日韩精品福利| 粉嫩aⅴ一区二区三区四区| 亚洲一区在线观看视频| 国产欧美一区在线| 精品欧美一区二区三区精品久久| 欧洲另类一二三四区| 99久久久免费精品国产一区二区| 国模少妇一区二区三区| 蜜臀久久久99精品久久久久久| 亚洲免费在线播放| 亚洲欧洲99久久| 久久久久久久久久久久久女国产乱 | 亚洲观看高清完整版在线观看| 国产免费观看久久| 久久色.com| 久久毛片高清国产| 精品久久一区二区| 精品国产欧美一区二区| 日韩欧美中文字幕精品| 91精品国产麻豆| 欧美日韩dvd在线观看| 欧美日韩三级一区二区| 欧美在线不卡一区| 欧美怡红院视频| 欧美午夜精品一区二区蜜桃| 91国产视频在线观看| 色欧美片视频在线观看| 91毛片在线观看| 欧美中文一区二区三区| 欧美亚一区二区| 欧美日韩国产一区| 欧美一区二区三区思思人| 日韩一区二区免费高清| 精品日韩在线观看| 国产亚洲1区2区3区| 国产精品久久午夜夜伦鲁鲁| 成人免费在线观看入口| 亚洲品质自拍视频| 亚洲丶国产丶欧美一区二区三区| 亚洲综合视频网| 香蕉久久一区二区不卡无毒影院| 亚洲资源在线观看| 午夜视频一区在线观看| 久久国产综合精品| 高清不卡在线观看| 91丝袜美女网| 91精品中文字幕一区二区三区| 日韩欧美久久久| 中文在线一区二区| 亚洲一区二区三区中文字幕 | 日韩欧美美女一区二区三区| 久久久.com| 一区二区在线观看免费| 天天色天天操综合| 国产一区二区三区日韩| 成人免费高清在线观看| 欧美三级午夜理伦三级中视频| 欧美一区二区三区在线| 久久久久一区二区三区四区| 中文字幕日韩一区| 日韩精品1区2区3区| 国产毛片精品国产一区二区三区| 99麻豆久久久国产精品免费优播| 精品视频一区二区不卡| 久久一区二区视频| 亚洲精选视频在线| 国产在线精品不卡| 在线日韩一区二区| 久久久噜噜噜久久人人看| 一区二区三区免费看视频| 麻豆国产欧美一区二区三区| 色综合久久中文综合久久牛| 欧美videos大乳护士334| 亚洲日本中文字幕区| 久久精品国产在热久久| 一本色道久久综合亚洲精品按摩| 日韩精品最新网址| 亚洲一区二区三区在线看| 国产丶欧美丶日本不卡视频| 欧美日韩www| 亚洲免费在线观看视频| 国产乱人伦偷精品视频免下载| 欧美三级乱人伦电影| 国产精品美女久久久久久2018| 日韩中文字幕91| 色噜噜狠狠一区二区三区果冻| 久久一区二区三区国产精品| 午夜影视日本亚洲欧洲精品| 99久久精品国产一区二区三区| 日韩欧美国产电影| 天堂在线亚洲视频| 在线观看一区日韩| 亚洲日本在线视频观看| 成人蜜臀av电影| 国产日韩在线不卡| 国产在线看一区| 欧美一级片在线看| 水野朝阳av一区二区三区| 一本大道av一区二区在线播放| 中文字幕第一区第二区| 国产精品综合在线视频| 精品国产乱码久久久久久老虎| 日本美女一区二区| 制服丝袜日韩国产| 午夜精品aaa| 制服丝袜成人动漫| 日韩精品1区2区3区| 欧美日韩专区在线| 午夜欧美电影在线观看| 在线观看av不卡| 亚洲综合精品久久| 欧洲一区二区av| 亚洲成av人影院| 91精品啪在线观看国产60岁| 五月综合激情网| 欧美大片在线观看一区| 精品影视av免费|