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

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

?? usbdlib.c

?? vxworks嵌入式實時系統的 usb底層驅動代碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* usbdLib.c - USBD functional interface *//* Copyright 2000-2001 Wind River Systems, Inc. *//*Modification history--------------------01f,18sep01,wef  merge from wrs.tor2_0.usb1_1-f for veloce01e,08aug01,dat  Removing warnings01d,26jan00,rcb  Redefine <bandwidth> parameter to usbdPipeCreate() to		 express the number of bytes per second or bytes per frame		 depending on type of pipe.01c,29nov99,rcb  Increase frame number fields to 32-bits in 		 usbdCurrentFrameGet().01b,07sep99,rcb  Add management callbacks and set-bus-state API.01a,03jun99,rcb  First.*//*DESCRIPTIONImplements the USBD functional interface.  Functions are provided to invokeeach of the underlying USBD URBs (request blocks).In order to use the USBD, it is first necessary to invoke usbdInitialize().Multiple calls to usbdInitialize() may be nested so long as a correspondingnumber of calls to usbdShutdown() are also made.  This allows multiple USBDclients to be written independently and without concern for coordinating theinitialization of the independent clients.After calling usbdInitialize(), a typical system will call usbdHcdAttach()at least one time in order to attach a USB HCD (Host Controller Driver) to the USBD.  The call to usbdHcdAttach() is not typically made by normal USBDclients.  Rather, this call is generally made by a "super client" or bysystem initialization code.  After the USBD has been initialized and at least one HCD has been attached,then normal USBD operation may begin.  Normal USBD clients must registerwith the USBD by calling usbdClientRegister().	In response to this call, theUSBD allocates per-client data structures and a client callback task.Callbacks for each client are invoked from this client-unique task.  Thisimproves the USBD's ability to shield clients from one-another and to helpensure the real-time response for all clients.After a client has registered, it will most often also register for dynamicattachment notification using usbdDynamicAttachRegister().  This functionallows a special client callback routine to be invoked each time a USB deviceis attached or removed from the system.  In this way, clients may discover thereal-time attachment and removal of devices.Finally, clients may use a combination of the USBD configuration and transferfunctions to configure and exchange data with USB devices.*//* includes */#include "usb/usbPlatform.h"#include "string.h"#include "usb/ossLib.h" 	/* OS services */#include "usb/usbQueueLib.h"#include "usb/usbdLib.h"	/* our API */#include "usb/usbdCoreLib.h"	/* interface to USBD core library *//* defines */#define MAX_SYNCH_SEM	    8		/* Max simultaneous requests which */					/* can be synchronized */#define SYNCH_SEM_TIMEOUT   1000	/* Time to wait for synch sem to be */					/* released during shutdown *//* locals */LOCAL int initCount = 0;		/* init nesting count */LOCAL BOOL ossInitialized = FALSE;	/* TRUE if we initialized ossLib */LOCAL BOOL coreLibInitialized = FALSE;	/* TRUE if we initialized usbdCoreLib */LOCAL QUEUE_HANDLE semPoolQueue = NULL; /* pool of synchronizing semaphores *//***************************************************************************** urbInit - Initialize a URB** Initialize the caller's URB to zeros, then store the <clientHandle>,* <function>, <callback>, <userPtr>, and <totalLen> fields passed by the* caller.** RETURNS: N/A*/LOCAL VOID urbInit    (    pURB_HEADER pUrb,			/* Clients URB */    USBD_CLIENT_HANDLE clientHandle,	/* Client handle */    UINT16 function,			/* USBD function code for header */    URB_CALLBACK callback,		/* Completion callback routine */    pVOID userPtr,			/* User-defined pointer */    UINT16 totalLen			/* Total len of URB to be allocated */    )    {    memset (pUrb, 0, totalLen);    pUrb->handle = clientHandle;    pUrb->function = function;    pUrb->callback = callback;    pUrb->userPtr = userPtr;    pUrb->urbLength = totalLen;    }/***************************************************************************** urbCallback - Internal callback used for asynchronous USBD functions** This callback will be used by urbExecBlock() as the URB_HEADER.callback* routine when urbExecBlock() executes an asynchronous USBD function.* By convention, the URB_HEADER.userPtr field will contain the SEM_HANDLE* of a semaphore which should be signalled.** RETURNS: N/A*/LOCAL VOID urbCallback    (    pVOID pUrb				/* Completed URB */    )    {    OSS_SEM_GIVE ((SEM_HANDLE) ((pURB_HEADER) pUrb)->userPtr);    }/***************************************************************************** urbExecBlock - Block on the execution of the caller's URB** Execute the <pUrb> passed by the caller and block until execution* completes. ** RETURNS: OK, or ERROR if error detected while trying to execute URB*/LOCAL STATUS urbExecBlock    (    pURB_HEADER pUrb			/* Caller's URB */    )    {    USB_MESSAGE msg;        /* Have we been initialized? */    if (initCount == 0)	return ossStatus (S_usbdLib_NOT_INITIALIZED);    /* Get a semaphore from the pool of synchronization semaphores to be     * used for this URB.     */    if (usbQueueGet (semPoolQueue, &msg, OSS_BLOCK) != OK)	return ossStatus (S_usbdLib_OUT_OF_RESOURCES);    /* msg.lParam is an available SEM_HANDLE. */    pUrb->callback = urbCallback;    pUrb->userPtr = (pVOID) msg.lParam;    if (usbdCoreEntry (pUrb) == OK)	{	/* wait for the URB to complete */	OSS_SEM_TAKE ((SEM_HANDLE) msg.lParam, OSS_BLOCK);	}    else	{	/* If the USBD reported an error, we don't know if the URB	 * callback was invoked or not (depends on how bad an error	 * the USBD detected, e.g., malformed URB).  So, we need to	 * make sure the semaphore is returned to the cleared state	 * before we put it back on the queue.	 */	OSS_SEM_TAKE ((SEM_HANDLE) msg.lParam, OSS_DONT_BLOCK);	}    usbQueuePut (semPoolQueue, 0, 0, msg.lParam, OSS_BLOCK);    return (pUrb->result == OK) ? OK : ERROR;    }/***************************************************************************** usbdInitialize - Initialize the USBD** usbdInitialize() must be called at least once prior to calling other* USBD functions.  usbdInitialize() prepares the USBD to process URBs.* Calls to usbdInitialize() may be nested, allowing multiple USBD clients* to be written independently.** RETURNS: OK, or ERROR if initialization failed.** ERRNO:*  S_usbdLib_GENERAL_FAULT*  S_usbdLib_OUT_OF_RESOURCES*  S_usbdLib_INTERNAL_FAULT*/STATUS usbdInitialize (void)    {    URB_CLIENT_UNREG urb;    SEM_HANDLE semHandle;    STATUS s = OK;    int i;    /* If not already initialized... */    if (++initCount == 1)	{	/* Initialize osServices */	if (ossInitialize () != OK)	    {	    s = ossStatus (S_usbdLib_GENERAL_FAULT);	    }	else	    {	    ossInitialized = TRUE;	    /* Create a pool of semaphores which will be used to synchronize 	     * URB completion. */	    if (usbQueueCreate (MAX_SYNCH_SEM, &semPoolQueue) != OK)		{		s = ossStatus (S_usbdLib_OUT_OF_RESOURCES);		}	    else		{		for (i = 0; s == OK && i < MAX_SYNCH_SEM; i++)		    {		    if (OSS_SEM_CREATE (1, 0, &semHandle) != OK ||			usbQueuePut (semPoolQueue, 0, 0, (UINT32) semHandle,			    OSS_DONT_BLOCK) != OK)			{			s = ossStatus (S_usbdLib_INTERNAL_FAULT);			}		    }		/* Initialize USBD core library */		if (s == OK)		    {		    urbInit (&urb.header, NULL, USBD_FNC_INITIALIZE, NULL, NULL,			sizeof (urb));		    if ((s = urbExecBlock (&urb.header)) == OK)			{			coreLibInitialized = TRUE;			}		    }		}	    }	}    if (s != OK)	usbdShutdown ();    return s;    }/***************************************************************************** usbdShutdown - Shuts down the USBD** usbdShutdown() should be called once for every successful call to * usbdInitialize().  This function frees memory and other resources used* by the USBD.** RETURNS: OK, or ERROR if shutdown failed.** ERRNO:*  S_usbdLib_NOT_INITIALIZED*/STATUS usbdShutdown (void)    {    URB_CLIENT_UNREG urb;    USB_MESSAGE msg;    STATUS s = OK;    int i;    if (initCount == 0)	{	/* Not initialized */	s = ossStatus (S_usbdLib_NOT_INITIALIZED);	}    else	{	/* We've been initialized at least once. */	if (initCount == 1)	    {	    if (coreLibInitialized)		{		/* Execute Shutdown URB */		urbInit (&urb.header, NULL, USBD_FNC_SHUTDOWN, NULL, NULL,		    sizeof (urb));		urbExecBlock (&urb.header);		coreLibInitialized = FALSE;		}	    if (semPoolQueue != NULL)		{		for (i = 0; i < MAX_SYNCH_SEM &&		    usbQueueGet (semPoolQueue, &msg, SYNCH_SEM_TIMEOUT) == OK; 		    i++)		    {		    OSS_SEM_DESTROY ((SEM_HANDLE) msg.lParam); 		    }		usbQueueDestroy (semPoolQueue);		semPoolQueue = NULL;		}	    if (ossInitialized)		{		/* Shut down osServices library */		ossShutdown ();		ossInitialized = FALSE;		}	    }	--initCount;	}    return s;    }/***************************************************************************** usbdClientRegister - Registers a new client with the USBD** This routine invokes the USBD function to register a new client.  * <pClientName> should point to a string of not more than USBD_NAME_LEN * characters (excluding terminating NULL) which can be used to uniquely * identify the client.	If successful, upon return the <pClientHandle>* will be filled with a newly assigned USBD_CLIENT_HANDLE.** RETURNS: OK, or ERROR if unable to register new client.*/STATUS usbdClientRegister     (    pCHAR pClientName,			/* Client name */    pUSBD_CLIENT_HANDLE pClientHandle	/* Client hdl returned by USBD */    )    {    URB_CLIENT_REG urb;    STATUS s;        /* Initialize URB */    urbInit (&urb.header, 0, USBD_FNC_CLIENT_REG, NULL, NULL, sizeof (urb));        if (pClientName != NULL)	strncpy (urb.clientName, pClientName, USBD_NAME_LEN);    /* Execute URB */    s = urbExecBlock (&urb.header);    /* Return result */    if (pClientHandle != NULL)	*pClientHandle = urb.header.handle;    return s;    }/***************************************************************************** usbdClientUnregister - Unregisters a USBD client** A client invokes this function to release a previously assigned * USBD_CLIENT_HANDLE.  The USBD will release all resources allocated to * the client, aborting any outstanding URBs which may exist for the client.  ** Once this function has been called with a given clientHandle, the client* must not attempt to reuse the indicated <clientHandle>.** RETURNS: OK, or ERROR if unable to unregister client.*/STATUS usbdClientUnregister    (    USBD_CLIENT_HANDLE clientHandle	/* Client handle */    )    {    URB_CLIENT_UNREG urb;    /* Initialize URB */    urbInit (&urb.header, clientHandle, USBD_FNC_CLIENT_UNREG, NULL, NULL,	sizeof (urb));    /* Execute URB */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩视频在线第一区 | 国产一区二区三区蝌蚪| 成人性视频免费网站| 欧美精品一二三| 亚洲视频图片小说| 国产成人综合亚洲网站| 8x8x8国产精品| 亚洲综合在线第一页| 国产a级毛片一区| 精品日韩在线观看| 亚洲成人免费视| 91视频国产资源| 国产精品国产自产拍在线| 精品制服美女丁香| 欧美一区二区在线看| 伊人开心综合网| 91香蕉视频mp4| 国产精品久久久爽爽爽麻豆色哟哟 | 久久久久久久综合| 男女视频一区二区| 91精品免费观看| 日韩av在线发布| 欧美日韩国产高清一区二区三区 | 国产精品美女久久久久aⅴ| 久久99久久久久| 欧美mv日韩mv国产网站| 久久精品国产免费| 日韩你懂的在线播放| 老司机免费视频一区二区三区| 欧美影院精品一区| 亚洲福利视频一区二区| 欧美主播一区二区三区| 亚洲午夜日本在线观看| 欧美日韩国产中文| 日本不卡在线视频| 日韩欧美一二三| 久久99国产精品免费网站| 久久综合一区二区| 成人夜色视频网站在线观看| 国产精品国产三级国产普通话99| 99国产精品视频免费观看| 亚洲三级在线看| 欧美日韩在线三级| 麻豆极品一区二区三区| 久久久久国产成人精品亚洲午夜| 国产69精品久久久久777| 国产精品水嫩水嫩| 欧洲日韩一区二区三区| 日韩高清不卡一区二区三区| 精品国产一区二区亚洲人成毛片| 国产精品1区2区| 亚洲欧美一区二区在线观看| 在线一区二区观看| 日韩福利电影在线| 国产欧美一区二区精品忘忧草| 97久久超碰精品国产| 午夜欧美2019年伦理| 26uuu精品一区二区在线观看| 国产不卡视频一区| 亚洲国产精品综合小说图片区| 日韩欧美一级特黄在线播放| 成人免费福利片| 亚洲小说春色综合另类电影| 2022国产精品视频| 在线免费av一区| 韩国一区二区三区| 亚洲午夜电影网| 国产欧美精品在线观看| 欧亚洲嫩模精品一区三区| 激情小说亚洲一区| 亚洲黄色小视频| 久久人人超碰精品| 欧美裸体一区二区三区| 国产91丝袜在线播放九色| 图片区小说区国产精品视频| 国产精品网曝门| 欧美一级二级在线观看| 一本色道亚洲精品aⅴ| 狠狠网亚洲精品| 亚洲国产日韩综合久久精品| 久久久亚洲精华液精华液精华液| 欧美主播一区二区三区美女| 国产成人在线观看| 日本欧美一区二区| 亚洲免费观看高清| 国产视频在线观看一区二区三区| 欧美顶级少妇做爰| 色哟哟精品一区| 成人午夜电影小说| 久久精品国产一区二区| 五月婷婷综合网| 亚洲精品欧美专区| 国产精品国产三级国产a| 欧美成人一区二区| 欧美一区二区人人喊爽| 91福利在线看| 色综合色综合色综合色综合色综合| 国模少妇一区二区三区| 日本最新不卡在线| 亚洲h精品动漫在线观看| 亚洲免费在线视频一区 二区| 国产欧美日韩中文久久| 26uuu亚洲综合色欧美 | 欧美一区二区在线不卡| 在线免费观看日韩欧美| 日本韩国欧美在线| 色综合天天综合在线视频| 成人一区二区三区中文字幕| 国产成人激情av| 粉嫩久久99精品久久久久久夜| 国产精品一区二区男女羞羞无遮挡 | 夜夜嗨av一区二区三区中文字幕 | 精品一区二区三区视频| 美女爽到高潮91| 久久国产精品区| 久久99国产精品久久99果冻传媒| 免费人成在线不卡| 三级一区在线视频先锋| 日本中文字幕一区二区视频| 丝袜美腿亚洲一区| 久久成人18免费观看| 国产一区二区三区四| 国产成人精品网址| 99在线精品观看| 91久久久免费一区二区| 欧美人狂配大交3d怪物一区| 欧美高清你懂得| 国产精品久久久久aaaa樱花| 国产精品大尺度| 亚洲精品国产视频| 天堂va蜜桃一区二区三区漫画版| 日本免费在线视频不卡一不卡二 | 色哟哟国产精品| 欧美精品自拍偷拍| 欧美精品一区二区三区在线 | 99久久免费精品| 欧洲在线/亚洲| 欧美成人精品3d动漫h| 国产视频一区不卡| 亚洲精品成人天堂一二三| 婷婷久久综合九色综合伊人色| 免费高清不卡av| proumb性欧美在线观看| 欧美日本不卡视频| 国产欧美一区二区精品仙草咪| 亚洲激情成人在线| 韩国一区二区在线观看| 99天天综合性| 日韩精品综合一本久道在线视频| 国产欧美日本一区视频| 亚洲第一福利视频在线| 国产精品一级片| 精品视频色一区| 国产精品―色哟哟| 奇米精品一区二区三区在线观看一 | 捆绑紧缚一区二区三区视频| av在线播放不卡| 欧美成人vps| 一区二区三区在线视频免费观看| 蜜桃久久av一区| 91成人网在线| 久久精品免费在线观看| 亚洲成人福利片| 99久久婷婷国产综合精品| 欧美精品一区二区三区在线播放| 一区二区免费在线播放| 国产91在线看| 337p日本欧洲亚洲大胆精品 | 中文字幕字幕中文在线中不卡视频| 日本不卡视频在线| 欧美综合一区二区三区| 国产色产综合产在线视频| 日本不卡一二三| 欧美伊人久久大香线蕉综合69 | 午夜在线成人av| 成人免费的视频| 26uuu精品一区二区三区四区在线| 亚洲一二三四在线观看| 99久久99久久久精品齐齐| 欧美精品一区在线观看| 蜜臀av性久久久久蜜臀aⅴ流畅| 欧洲人成人精品| 夜夜精品视频一区二区| 99r国产精品| 91麻豆免费观看| 精品免费一区二区三区| 一区二区三区欧美在线观看| av综合在线播放| 中文字幕欧美激情| 国产1区2区3区精品美女| 精品精品欲导航| 久久av资源站| 精品少妇一区二区三区免费观看 | 欧美三级日韩在线| 亚洲欧美欧美一区二区三区| 成人久久久精品乱码一区二区三区| 久久在线观看免费| 国产乱子轮精品视频| 亚洲精品一区二区三区精华液| 美国十次综合导航|