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

📄 usbhubclassinterface.c

📁 风河的vxworks-6.3 FOR amcc440epx BSP!
💻 C
📖 第 1 页 / 共 4 页
字号:
            uPortIndex,            pParentHub->HubDescriptor.bNbrPorts,            0,            0);        return;            } /* End of (uPortIndex > (pParentHub->.... */    /*     * Retrieve HUB_INFO structure from     * parentHub::pPortList[uPortIndex]::pHub.     */    pPort = pParentHub->pPortList[uPortIndex];    /* update the hub information */    OS_ASSERT( NULL != pPort->pHub);                                /* Verify */    pHub=pPort->pHub;    /* If the HUB_INFO structure is NULL then return. */    if (NULL == pHub)    {        /* Debug Message */        OS_LOG_MESSAGE_HIGH(            HUB,"usbHubSuspend: pHub is NULL \n",0,0,0,0);        return;    } /* End of if (NULL== pHub) */    /* Call the USBHST_CancelURB function to cancel the URB for the hub. */    usbHstURBCancel(&(pHub->StatusChangeURB));    /*     * for all the ports in the pHub::pPortList  which are enabled,     * i.    Call the g_USBHSTFunctionList::USBHST_SuspendDevice() function     *       for the pHub::pPortList[uPortCount]::DeviceHandle.     */    for (uPortCount = 0;          uPortCount < pHub->HubDescriptor.bNbrPorts;          uPortCount++)    {        /* Retrieve the HUB_PORT_INFO structure */        pUSB_HUB_PORT_INFO pPort = pHub->pPortList[uPortCount];        /* Check if the port is enabled */        if (NULL != pPort)        {            /* Debug Message */            OS_LOG_MESSAGE_LOW(                HUB,                "usbHubSuspend : suspending device %d\n",                uPortCount,                0,                0,                0);            /* Call function to suspend the device */            g_usbHstFunctionList.UsbdToHubFunctionList.suspendDevice                (                pPort->uDeviceHandle                );        } /* End of If (NULL != pPort) */    } /* End of for (uPortCount.... */		/* WindView Instrumentation */		USB_HUB_LOG_EVENT(			USB_HUB_WV_DEVICE,			"Exiting usbHubSuspend() Function",			USB_HUB_WV_FILTER);    /* Debug Message */    OS_LOG_MESSAGE_LOW(        HUB,        "usbHubSuspend : Done devH=0x%x pCon=0x%x\n",        uDeviceHandle,        (UINT32)pContext,        0,        0);            /* Return */    return;} /* End of function HUB_SuspendHub() *//***************************************************************************** usbHubResume - called by the USB Host Software Stack  for resuming a hub.** This routine is called by the USB Host Software Stack  for resuming a hub.** RETURNS: N/A** ERRNO: None** \NOMANUAL*/LOCAL void usbHubResume     (    UINT32 uDeviceHandle,    void * pContext    )    {    /* The pointer to the parent hub */    pUSB_HUB_INFO pParentHub       = NULL;    /* port number of the device */    UINT8 uPortIndex          = 0;    /* port count for the hub  */    UINT8 uPortCount           = 0;    /* Storage for the hub structure */    pUSB_HUB_INFO pHub             = NULL;    /* The port Information */    pUSB_HUB_PORT_INFO pPort       = NULL;    /* Result storage */    USBHST_STATUS Result;    /* WindView Instrumentation */    USB_HUB_LOG_EVENT(			USB_HUB_WV_DEVICE,			"Entering usbHubResume() Function",			USB_HUB_WV_FILTER);    /* Debug Message */    OS_LOG_MESSAGE_LOW(        HUB,        "usbHubResume : Called devH=0x%x pCon=0x%x\n",        uDeviceHandle,        (UINT32)pContext,        0,        0);    /* If pContext is NULL then return. */    if (NULL==pContext)    {        /* Debug Message */        OS_LOG_MESSAGE_MEDIUM(            HUB,"usbHubResume : pContext is NULL\n",0,0,0,0);        return;    } /* End of if (NULL==pContext..*/    /* Get the parent hub pointer from the pContext. */    pParentHub= (pUSB_HUB_INFO) pContext;    /* get the port number */    uPortIndex = usbHubFindPortNumber(pParentHub,uDeviceHandle);    /* Check  if the port is found */    if (USB_PORT_NUMBER_NOT_FOUND == uPortIndex)    {        /* Debug Message */        OS_LOG_MESSAGE_HIGH(            HUB,"usbHubResume : port num not found\n",0,0,0,0);        return;    } /* End of if (PORT_NUM.. */    /* Check if the port number is within limits */    if (uPortIndex > (pParentHub->HubDescriptor.bNbrPorts))    {        /* Debug Message */        OS_LOG_MESSAGE_HIGH(            HUB,            "usbHubResume : port %d > %d\n",            uPortIndex,            pParentHub->HubDescriptor.bNbrPorts,            0,            0);        return;    } /* End of (uPortIndex > (pParentHub->.... */    /*     * Retrieve HUB_INFO structure from     * parentHub::pPortList[uPortIndex]::pHub.     */    pPort = pParentHub->pPortList[uPortIndex];    /* update the hub information */    OS_ASSERT( NULL != pPort->pHub);                                /* Verify */    pHub=pPort->pHub;    /* If the HUB_INFO structure is NULL then return. */    if (NULL == pHub)    {        /* Debug Message */        OS_LOG_MESSAGE_HIGH(            HUB,"usbHubResume : pHub is NULL\n",0,0,0,0);        return;    } /* End of if (NULL== pHub) */    /*     * Call the HUB_SubmitInterruptRequest() function to submit the URB for the     * hub.     */    Result = usbHubSubmitInterruptRequest(pHub);    /* If the SubmitInterruptRequest fails then,     *  i.    Call the HUB_SubmitFeature() to disable the port.     * ii.    Call the HUB_RemoveDevice() function to     *        delete the device.     * iii.   Return.     */    if (USBHST_SUCCESS != Result)    {        /* Debug Message */        OS_LOG_MESSAGE_HIGH(            HUB,            "usbHubResume :INRequest submission failed 0x%x\n",            Result,            0,            0,            0);        /* Disable the port */        Result = USB_HUB_CLEAR_PORT_FEATURE(pParentHub,uPortIndex,USB_PORT_ENABLE);        /* 9/5/2k3:NM: Changed here to centralise the effect*/        usbHubRemoveDevice(pParentHub,uPortIndex);        /* return */        return;    }/* End of if (USBHST_SUCCESS != Result ) */    /*     * for all the ports in the pHub::pPortList  which are enabled,     * i.    Call the g_USBHSTFunctionList::USBHST_ResumeDevice() function     *       for the pHub::pPortList[uPortCount]::DeviceHandle.     */    for (uPortCount = 0;         uPortCount < pHub->HubDescriptor.bNbrPorts;         uPortCount++)    {        /* Retrieve the HUB_PORT_INFO structure */        pUSB_HUB_PORT_INFO pPort = pHub->pPortList[uPortCount];        /* Check if the port is enabled */        if (NULL != pPort)        {            /* Debug Message */            OS_LOG_MESSAGE_HIGH(                HUB,                "usbHubResume : waking up port %d \n",                uPortCount,                0,                0,                0);            /* Call function to resume the device */            g_usbHstFunctionList.UsbdToHubFunctionList.resumeDevice                (                pPort->uDeviceHandle                );        } /* End of If (NULL != pPort) */    } /* End of for (uPortCount.... */		/* WindView Instrumentation */		USB_HUB_LOG_EVENT(			USB_HUB_WV_DEVICE,			"Exiting usbHubResume() Function",			USB_HUB_WV_FILTER);    /* Debug Message */    OS_LOG_MESSAGE_LOW(        HUB,        "usbHubResume : Done devH=0x%x pCon=0x%x\n",        uDeviceHandle,        (UINT32)pContext,        0,        0);    /* Return */    return;} /* End of function HUB_ResumeHub() *//***************************************************************************** usbHubSelectiveSuspendDevice - selectively suspending a device** Called by the USB Host Software Stack for selectively suspending a device.* In this process, it selectively suspends  the port of the parent hub where* the device is connected.** RETURNS: N/A** ERRNO: None** \NOMANUAL*/LOCAL USBHST_STATUS usbHubSelectiveSuspendDevice     (    UINT32 uDeviceHandle    )    {    /* The pointer to the parent hub */    pUSB_HUB_INFO pParentHub       = NULL;    /* port number of the device */    UINT8 uPortIndex          = 0;    /* The port Information */    pUSB_HUB_PORT_INFO pPort       = NULL;    /* Storage for the result */    USBHST_STATUS  Result;    /* WindView Instrumentation */    USB_HUB_LOG_EVENT(			USB_HUB_WV_DEVICE,			"Entering usbHubSelectiveSuspendDevice() Function",			USB_HUB_WV_FILTER);    /* Debug Message */    OS_LOG_MESSAGE_LOW(        HUB,        "usbHubSelectiveSuspendDevice: Called devH=0x%x\n",        uDeviceHandle,        0,        0,        0);    /*     * Call HUB_FindParentHubInBuses() to find the parent hub and If this     * is not found, then return USBHST_INVALID_PARAMETER.     */    pParentHub = usbHubFindParentHubInBuses(uDeviceHandle);    /* if not found return USBHST_INVALID_PARAMETER */    if (NULL == pParentHub)    {        /* Debug Message */        OS_LOG_MESSAGE_MEDIUM(            HUB,            "usbHubSelectiveSuspendDevice: parent hub not found\n",            0,            0,            0,            0);                    return USBHST_INVALID_PARAMETER;            }/* End of if (NULL == pParentHub ) */    /*     * HUB_FindPortNumber() to find the port number for this device handle.     * If this is not found, then return USBHST_INVALID_PARAMETER.     */    uPortIndex = usbHubFindPortNumber(pParentHub,uDeviceHandle);    /* Check  if the port is found */    if (USB_PORT_NUMBER_NOT_FOUND == uPortIndex)    {        /* Debug Message */        OS_LOG_MESSAGE_MEDIUM(            HUB,            "usbHubSelectiveSuspendDevice: port num not found\n",            0,            0,            0,            0);                    return USBHST_INVALID_PARAMETER;            } /* End of if (PORT_NUM.. */    /* Check if the port number is within limits */    if (uPortIndex > (pParentHub->HubDescriptor.bNbrPorts))    {        /* Debug Message */        OS_LOG_MESSAGE_MEDIUM(            HUB,            "usbHubSelectiveSuspendDevice: port=%d > %d\n",            uPortIndex,            pParentHub->HubDescriptor.bNbrPorts,            0,            0);                    return USBHST_INVALID_PARAMETER;            } /* End of (uPortIndex > (pParentHub->.... */    /*     * Retrieve HUB_INFO structure from     * parentHub::pPortList[uPortIndex]::pHub.     */    pPort = pParentHub->pPortList[uPortIndex];    OS_ASSERT( NULL == pPort->pHub);                                /* Verify */    /*     * Call the HUB_SubmitFeature() function to submit a selective suspend to     * the parent hub on the port number.     * Note: The actual port number is 1 more than the port index     */    Result = USB_HUB_SET_PORT_FEATURE(pParentHub,uPortIndex,USB_PORT_SUSPEND);		/* WindView Instrumentation */		USB_HUB_LOG_EVENT(			USB_HUB_WV_DEVICE,			"Exiting usbHubSelectiveSuspendDevice() Function",			USB_HUB_WV_FILTER);    /* Debug Message */    OS_LOG_MESSAGE_LOW(        HUB,         "usbHubSelectiveSuspendDevice: Done devH=0x%x result =0x%x\n",        uDeviceHandle,        Result,        0,        0);    /* Return the result of the submission.*/    return Result;} /* End of function HUB_SelectiveSuspendDevice() *//***************************************************************************** usbHubSelectiveResumeDevice - selectively resuming a device.** Called by the USB Host Software Stack for selectively resuming a device.* In this process it selectively resumes the port of the parent hub where the* device is connected.*** RETURNS: USBHST_STATUS** ERRNO: None** \NOMANUAL*/LOCAL USBHST_STATUS usbHubSelectiveResumeDevice     (    UINT32 uDeviceHandle    )    {   /* The pointer to the parent hub */    pUSB_HUB_INFO pParentHub       = NULL;    /* port number of the device */    UINT8 uPortIndex          = 0;    /* The port Information */    pUSB_HUB_PORT_INFO pPort       = NULL;    /* The Result Storage */    USBHST_STATUS Result      = USBHST_FAILURE;    /* WindView Instrumentation */    USB_HUB_LOG_EVENT(			USB_HUB_WV_DEVICE,			"Entering usbHubSelectiveResumeDevice() Function",			USB_HUB_WV_FILTER);    /* Debug Message */    OS_LOG_MESSAGE_LOW(        HUB,        "usbHubSelectiveResumeDevice: Called devH=0x%x\n",        uDeviceHandle,        0,        0,        0);    /*     * Call HUB_FindParentHubInBuses() to find the parent hub and If this     * is not found, then return USBHST_INVALID_PARAMETER.     */    pParentHub = usbHubFindParentHubInBuses(uDeviceHandle);    /* if not found return USBHST_INVALID_PARAMETER */    if (NULL == pParentHub)    {        /* Debug Message */        OS_LOG_MESSAGE_MEDIUM(            HUB, "usbHubSelectiveResumeDevice: parent hub not found\n",0,0,0,0);        return USBHST_INVALID_PARAMETER;    }/* End of if (NULL == pParentHub ) */

⌨️ 快捷键说明

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