⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usbtargutil.c

📁 USB source code of Vxworks 5.6. It has device and the host stack.
💻 C
字号:
/* usbTargUtil.c - Utility Functions *//* Copyright 2004 Wind River Systems, Inc. *//*Modification history--------------------01b,11may04,hch  Merge after D12 driver testing01b,19jul04,ami Coding Convention Changes01a,31mar04,ami First*//*DESCRIPTIONThis file consists of utility functions which are used bythe usbTarget Library files.INCLUDE FILES: usb/usbPlatform.h, string.h, usb/ossLib.h, usb/usb.h,                usb/usbHandleLib.h, usb/target/HalLib.h,               usb/target/usbTargLib.h, usb/target/usbTargUtil.h*//* includes */#include "usb/usbPlatform.h"	 #include "usb/ossLib.h" 	     #include "usb/usb.h"		   #include "usb/usbHandleLib.h"	   #include "usb/target/usbHalLib.h"    #include "usb/target/usbTargLib.h"/* globals */extern UINT16 initCount;/********************************************************************************* validateTarg - validate a target channel and the state of usbTargLib** If <ppTcd> is not NULL, then validate the <targChannel> parameter.* Also checks to make sure usbTargLib has been properly initialized.** RETURNS: OK or ERROR if unable to validate target channel** ERRNO:* \is* \i S_usbTargLib_NOT_INITIALIZED* Uninitialized variable used.** \i S_usbTargLib_BAD_HANDLE* Wrong handle value returned.** \i S_usbTargLib_BAD_PARAM* Bad Parameter is passed.* \ie** \NOMANUAL*/int validateTarg    (    USB_TARG_CHANNEL	targChannel,	/* target channel */    struct targTcd	 ** ppTcd	/* pointer to pTARG_TCD */    )    {    if (initCount == 0)        return ossStatus (S_usbTargLib_NOT_INITIALIZED);    if (ppTcd != NULL)        {        if (usbHandleValidate (targChannel, TARG_TCD_SIG, (pVOID *) ppTcd)             != OK)	      return ossStatus (S_usbTargLib_BAD_HANDLE);        }    else        return ossStatus (S_usbTargLib_BAD_PARAM);    return OK;    }/********************************************************************************* mngmtFunc - invokes target application's mngmtFunc callback.** If there is no mngmtFunc, returns OK.** RETURNS: return code (OK, ERROR) from mngmtFunc.** ERRNO:*   None.** \NOMANUAL*/STATUS mngmtFunc    (    pTARG_TCD	pTcd,		/* TARG_TCD */    UINT16	mngmtCode,	/* management code */    pVOID	pContext	/* parameter passed for the function */    )    {    if (pTcd->pCallbacks->mngmtFunc == NULL)	return ERROR;    return ((*pTcd->pCallbacks->mngmtFunc)	(pTcd->callbackParam, pTcd->targChannel, mngmtCode, pContext));    }/********************************************************************************* cntlEndpointStall -  stalls defaults endpoints** This is a utility function to stall the default control IN and OUT* endpoints.** RETURNS: N/A** ERRNO:*   None.** \NOMANUAL*/VOID cntlEndpointStall    (    pTARG_TCD	pTcd		/* TARG_TCD */    )    {    /* Stall Control In Endpoint */    usbHalTcdEndpointStateSet (&pTcd->tcdNexus , &pTcd->defaultControlPipeIN,                                 TCD_ENDPOINT_STALL);    /* Stall Control Out Endpoint */    usbHalTcdEndpointStateSet (&pTcd->tcdNexus , &pTcd->defaultControlPipeOUT,                                 TCD_ENDPOINT_STALL);    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -