📄 usbohcitransfermanagement.c
字号:
pTempEndpointDescriptor = pTempEndpointDescriptor->pHCDNextEndpointDescriptor; } /* Check whether the pipe is present in the control list */ if (pTempEndpointDescriptor == pEndpointDescriptor) { /* * Call the function to delete the pipe from the list of * control pipes. */ nStatus = usbOhciDeleteControlPipe (uHostControllerIndex, pTempEndpointDescriptor); /* Debug print */ OS_LOG_MESSAGE_LOW( OHCD, "Exiting the function: usbOhciDeletePipe().\n", 0, 0, 0, 0); /* Return from the function */ return nStatus; } } /* * Check whether the pipe is present in the list of control pipes. * If present, delete the pipe and return the status. (END) */ /* * Check whether the pipe is present in the list of bulk pipes. * If present, delete the pipe and return the status. (BEGIN) */ /* Read the contents of the HcBulkHeadED */ pTempEndpointDescriptor = (PUSB_OHCI_ENDPOINT_DESCRIPTOR) (USB_OHCD_CONVERT_FROM_BUS_MEM (uHostControllerIndex, (USB_OHCI_REG_READ ( uHostControllerIndex, uBaseAddress + USB_OHCI_BULK_HEAD_ED_REGISTER_OFFSET)))); if (pTempEndpointDescriptor != NULL) { /* Retieve the actual allocated ED from the stored pointer */ pTempEndpointDescriptor = pTempEndpointDescriptor->pAlignedED; } /* Check whether the bulk list is valid */ if (pTempEndpointDescriptor != NULL) { /* * Check whether the pipe corresponds to the pipe at the head * of list of bulk pipes. */ if (pTempEndpointDescriptor == pEndpointDescriptor) { /* * Call the function to delete the pipe from the list of * bulk pipes. */ nStatus = usbOhciDeleteBulkPipe (uHostControllerIndex, pTempEndpointDescriptor); /* Debug print */ OS_LOG_MESSAGE_LOW( OHCD, "Exiting the function: usbOhciDeletePipe().\n", 0, 0, 0, 0); /* Return from the function */ return nStatus; } /* * Traverse the bulk list to check whether pipe is present in * the list of bulk pipes */ while ((pTempEndpointDescriptor != NULL) && (pTempEndpointDescriptor != pEndpointDescriptor)) { /* Traverse to the next element in the list */ /* Copy the value in the HCD maintained next pointer */ pTempEndpointDescriptor = pTempEndpointDescriptor->pHCDNextEndpointDescriptor; } /* Check whether the pipe is present in the bulk list */ if (pTempEndpointDescriptor == pEndpointDescriptor) { /* * Call the function to delete the pipe from the list of * bulk pipes. */ nStatus = usbOhciDeleteBulkPipe (uHostControllerIndex, pTempEndpointDescriptor); /* Debug print */ OS_LOG_MESSAGE_LOW( OHCD, "Exiting the function: usbOhciDeletePipe().\n", 0, 0, 0, 0); /* Return from the function */ return nStatus; } } /* * Check whether the pipe is present in the list of bulk pipes. * If present, delete the pipe and return the status. (END) */ /* * Check whether the pipe is present in the list of periodic pipes. * If present, delete the pipe and return the status. (BEGIN) */ /* Obtain the polling interval from the endpoint descriptor */ uPollingInterval = pEndpointDescriptor->uPollingInterval; /* Obtain the pointer to the head of the periodic list */ puPeriodicListHead = (UINT32 *)(pOhciControllerInfo->pHccaAligned + USB_OHCI_HCCA_INERRUPT_TABLE_OFFSET ); /* * Search for the endpoint descriptor in the list of periodic pipes * for the specified polling interval */ for (uIndex = 0; uIndex < uPollingInterval; uIndex++) { /* * Obtain the pointer to the head of the periodic list for * the specified polling interval. */ pTempEndpointDescriptor = (PUSB_OHCI_ENDPOINT_DESCRIPTOR) puPeriodicListHead[uIndex]; /* If the pointer is not NULL, retrieve the actual allocated address by * used by the HCD. */ if (pTempEndpointDescriptor != NULL) { /* Convert the address from the PCI address */ pTempEndpointDescriptor = (PUSB_OHCI_ENDPOINT_DESCRIPTOR) USB_OHCD_CONVERT_FROM_BUS_MEM(uHostControllerIndex, (USB_OHCD_SWAP_DATA(uHostControllerIndex, (UINT32)pTempEndpointDescriptor))); /* Extract the actual address used by the HCD */ pTempEndpointDescriptor = pTempEndpointDescriptor->pAlignedED; } /* Check for the pipe to be deleted */ while ((pTempEndpointDescriptor != NULL) && (pTempEndpointDescriptor != pEndpointDescriptor)) { /* Traverse to the next element in the periodic list */ pTempEndpointDescriptor = pTempEndpointDescriptor->pHCDNextEndpointDescriptor; } /* Check whether the pipe is found in the periodic list */ if (pTempEndpointDescriptor == pEndpointDescriptor) { break; } } /* Check whether the pipe is found in the periodic list */ if (pTempEndpointDescriptor == pEndpointDescriptor) { /* * Call the function to delete the pipe from the list of * periodic endpoints. */ nStatus = usbOhciDeletePeriodicPipe (uHostControllerIndex, pTempEndpointDescriptor); /* Debug print */ OS_LOG_MESSAGE_LOW( OHCD, "Exiting the function: usbOhciDeletePipe().\n", 0, 0, 0, 0); /* Return from the function */ return nStatus; } /* * Check whether the pipe is present in the list of periodic pipes. * If present, delete the pipe and return the status. (END) */ /* Debug print */ OS_LOG_MESSAGE_LOW( OHCD, "Exiting the function: usbOhciDeletePipe().\n", 0, 0, 0, 0); return USBHST_FAILURE; } /* End of function usbOhciDeletePipe () *//***************************************************************************** usbOhciSubmitUrb - submit a request** This function is used to submit a request to the device.** PARAMETERS: <uHostControllerIndex (IN)> - OHCI Host Controller index.** <uPipeHandle (IN)> - Handle to the pipe. The URB will be submitted for this* pipe.** <pURB (IN)> - Pointer to the URB to be submitted.** RETURNS: USBHST_SUCCESS on success,* USBHST_INVALID_PARAMETER if the parameters are not valid** ERRNO:* None.*/LOCAL USBHST_STATUS usbOhciSubmitUrb ( UINT8 uHostControllerIndex, UINT32 uPipeHandle, pUSBHST_URB pUrb ) { /* To hold the pointer to the host controller information */ PUSB_OHCI_INFORMATION pOhciControllerInfo = NULL; /* To hold the status of populating the transfer descriptor */ USBHST_STATUS nStatus = USBHST_SUCCESS; /* To hold the pointer to the OHCI endpoint descriptor */ PUSB_OHCI_ENDPOINT_DESCRIPTOR pOhciEndpointDescriptor = NULL; /* WindView Instrumentation */ USB_HCD_LOG_EVENT( USB_OHCI_WV_TRANSFER, "usbOhciSubmitUrb() starts", USB_OHCD_WV_FILTER); /* Debug print */ OS_LOG_MESSAGE_LOW( OHCD, "Entering the function: usbOhciSubmitUrb().\n", 0, 0, 0, 0); /* Check whether the OHCI host controller index is valid */ if (uHostControllerIndex >= maxOhciCount) { /* Debug print */ OS_LOG_MESSAGE_LOW( OHCD, "Exiting the function: usbOhciSubmitUrb().\n", 0, 0, 0, 0); return USBHST_INVALID_PARAMETER; } /* Check whether the URB parameter is valid */ if (pUrb == NULL) { /* Debug print */ OS_LOG_MESSAGE_LOW( OHCD, "Exiting the function: usbOhciSubmitUrb().\n", 0, 0, 0, 0); return USBHST_INVALID_PARAMETER; } /* Obtain the pointer to the host controller information */ pOhciControllerInfo = &usbOhciControllerInfo[uHostControllerIndex]; /* * Check whether the root hub is configured. * * NOTE: If the root hub is not configured, all the requests will be * directed to the root hub emulation module. */ if (pOhciControllerInfo->uRootHubState != USB_OHCI_DEVICE_CONFIGURED_STATE) { /* Call the root hub emulation function to handle the request */ nStatus = usbOhciProcessRootHubRequest (uHostControllerIndex, pUrb); /* Return the status of the root hub emulation function */ /* Debug print */ OS_LOG_MESSAGE_LOW( OHCD, "Exiting the function: usbOhciSubmitUrb().\n", 0, 0, 0, 0); return nStatus; } /* Check whether the request is addressed to the root hub */ if (pOhciControllerInfo->uRootHubAddress == (pUrb->hDevice & USB_OHCI_DEVICE_ADDRESS_MASK)) { /* Call the root hub emulation function to handle the request */ nStatus = usbOhciProcessRootHubRequest (uHostControllerIndex, pUrb); /* Return the status of the root hub emulation function */ /* Debug print */ OS_LOG_MESSAGE_LOW( OHCD, "Exiting the function: usbOhciSubmitUrb().\n", 0, 0, 0, 0); return nStatus; } /* * Check whether the pipe parameter is valid. * * NOTE: No pipes are created for the root hub. Hence validate the * pipe parameter after confirming the request is not for the * root hub. */ if (uPipeHandle == USB_OHCI_INVALID_PIPE_HANDLE) { /* Debug print */ OS_LOG_MESSAGE_LOW( OHCD, "Exiting the function: usbOhciSubmitUrb().\n", 0, 0, 0, 0); return USBHST_INVALID_PARAMETER;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -