📄 usbohcidebug.c
字号:
"[0x%08X]->TDQueueTail : 0x%08X\n", (UINT32) pOhciEndpointDescriptor, (UINT32) (pOhciEndpointDescriptor->TDQueueTail.pGeneralTDQueueTail),0,0,0,0); /* Display the pointer to the head of the transfer descriptor list */ OS_PRINTF( "[0x%08X]->TDQueueHead : 0x%08X\n", (UINT32) pOhciEndpointDescriptor, (UINT32) (pOhciEndpointDescriptor->TDQueueHead.pGeneralTDQueueHead),0,0,0,0); /* Display the pointer to the next endpoint descriptor list */ OS_PRINTF( "[0x%08X]->pNextEndpointDescriptor : 0x%08X\n", (UINT32) pOhciEndpointDescriptor, (UINT32) (pOhciEndpointDescriptor->pNextEndpointDescriptor),0,0,0,0); /* Initialize the pointer to the transfer descriptor */ pOhciGeneralTransferDescriptor = pOhciEndpointDescriptor->TDQueueHead.pGeneralTDQueueHead; /* * NOTE: The TDQueueHead field in the OHCI Endpoint descriptor also * contains the 'ToggleCarry (bit 1)' and 'Halt (bit 0)' bit. * * Hence, while using the TDQueueHead pointer, mask the least * significant 4 bits. */ /* Mask the TDQueueHead pointer address */ pOhciGeneralTransferDescriptor = (PUSB_OHCI_GENERAL_TRANSFER_DESCRIPTOR) (((UINT32) pOhciGeneralTransferDescriptor) & (~USB_OHCI_GENERAL_TRANSFER_DESCRIPTOR_ALIGNMENT_MASK)); /* Display the transfer descriptors for the endpoint */ while (pOhciGeneralTransferDescriptor != NULL) { /* Call the function to display the transfer descriptor */ usbOhciDumpGeneralTransferDescriptor ( (PVOID) pOhciGeneralTransferDescriptor); /* Obtain the pointer to the actual transfer descriptor */ pTempTransferDescriptor = (PUSB_OHCI_GENERAL_TRANSFER_DESCRIPTOR) ((UINT32) pOhciGeneralTransferDescriptor - USB_OHCI_GENERAL_TRANSFER_DESCRIPTOR_HEADER); /* Traverse to the next transfer descriptor in the list */ pOhciGeneralTransferDescriptor = pTempTransferDescriptor->pNextTransferDescriptor; } return; } /* End of function usbOhciDumpEndpointDescriptor () *//***************************************************************************** usbOhciDumpPeriodicEndpointList - dump periodic endpoint descriptor list** This function is used to dump the contents of the periodic endpoint * descriptor list.** PARAMETERS: <uHostControllerIndex (IN)> - Specifies the host controller index** RETURNS: N/A** ERRNO:* None.*/VOID usbOhciDumpPeriodicEndpointList ( UINT8 uHostControllerIndex ) { /* To hold the pointer to the host controller information */ PUSB_OHCI_INFORMATION pOhciControllerInfo = NULL; /* To hold the pointer to the base address of the periodic list */ PUSB_OHCI_ENDPOINT_DESCRIPTOR *pPeriodicList = NULL; /* To hold the loop index */ UINT32 uIndex = 0; /* Check whether the OHCI Bus Number is valid */ if (uHostControllerIndex >= uNumberOfOhciControllers) { /* Invalid OHCI Bus Number */ return; } /* Obtain the pointer to the OHCI host controller information */ pOhciControllerInfo = &usbOhciControllerInfo[uHostControllerIndex]; /* Obtain the pointer to the periodic list */ pPeriodicList = (PUSB_OHCI_ENDPOINT_DESCRIPTOR *) (pOhciControllerInfo->pHccaAligned->uHccaInterruptTable); /* Display the periodic endpoint list */ for (uIndex = 0; uIndex < USB_OHCI_MAXIMUM_POLLING_INTERVAL; uIndex++) { /* To hold the pointer to the current endpoint */ PUSB_OHCI_ENDPOINT_DESCRIPTOR pTempEndpointDescriptor = NULL; /* To hold the number of endpoints to be displayed per line */ UINT8 uCount = 0; /* Display the bandwidth reserved */ if (pPeriodicList[uIndex] != NULL) { OS_PRINTF("\n%02d [%04d]: ", uIndex, pPeriodicList[uIndex]->uBandwidthAvailable,0,0,0,0); } else { OS_PRINTF("\n%02d [0000]: \n", uIndex,0,0,0,0,0); } /* Initialize the pointer to the current endpoint descriptor */ pTempEndpointDescriptor = pPeriodicList[uIndex]; /* Display the tree of endpoints */ while (pTempEndpointDescriptor != NULL) { /* Format the display */ if (((uCount % 3) == 0) && (uCount != 0)) { OS_PRINTF("\n ",0,0,0,0,0,0); } /* * Display the address and polling interval for the * endpoint */ OS_PRINTF("0x%08X (%04d), ", (UINT32) pTempEndpointDescriptor, pTempEndpointDescriptor->uPollingInterval,0,0,0,0); /* Traverse to the next endpoint in the list */ pTempEndpointDescriptor = pTempEndpointDescriptor->pNextEndpointDescriptor; /* Increment the count */ uCount++; } /* Format the display */ if ((uCount % 3) != 0) { OS_PRINTF("\n",0,0,0,0,0,0); } } return; } /* End of function usbOhciDumpPeriodicEndpointList () *//***************************************************************************** usbOhciDumpGeneralTransferDescriptor - dump general transfer descriptor** This function is used to dump the contents of the general transfer * descriptor.** PARAMETERS: <pGeneralTransferDescriptor (IN)> - Pointer to the general* descriptor** RETURNS: N/A** ERRNO:* None.**/VOID usbOhciDumpGeneralTransferDescriptor ( PVOID pGeneralTransferDescriptor ) { /* To hold the pointer to the OHCI general transfer descriptor */ PUSB_OHCI_GENERAL_TRANSFER_DESCRIPTOR pOhciGeneralTransferDescriptor = NULL; /* To hold the pointer to the temporary OHCI general transfer descriptor */ PUSB_OHCI_GENERAL_TRANSFER_DESCRIPTOR pTempTransferDescriptor = NULL; /* Check whether the parameter is valid */ if (pGeneralTransferDescriptor == NULL) { return; } /* Initialize the pointer to the OHCI general transfer descriptor */ pOhciGeneralTransferDescriptor = (PUSB_OHCI_GENERAL_TRANSFER_DESCRIPTOR) pGeneralTransferDescriptor; /* Obtain the pointer to the actual transfer descriptor */ pTempTransferDescriptor = (PUSB_OHCI_GENERAL_TRANSFER_DESCRIPTOR) ((UINT32) pOhciGeneralTransferDescriptor - USB_OHCI_GENERAL_TRANSFER_DESCRIPTOR_HEADER); /* Display the endpoint descriptor */ OS_PRINTF( "[0x%08X]->pEndpointDescriptor : 0x%08X\n", (UINT32) pTempTransferDescriptor, (UINT32) pTempTransferDescriptor->pEndpointDescriptor,0,0,0,0); /* Display the control information */ OS_PRINTF( "[0x%08X]->uControlInformation : 0x%08X\n", (UINT32) pTempTransferDescriptor, pTempTransferDescriptor->uControlInformation,0,0,0,0); /* Display the current buffer pointer for this transfer descriptor */ OS_PRINTF( "[0x%08X]->pCurrentBufferPointer : 0x%08X\n", (UINT32) pTempTransferDescriptor, (UINT32) (pTempTransferDescriptor->pCurrentBufferPointer),0,0,0,0); /* Display the pointer to the next transfer descriptor */ OS_PRINTF( "[0x%08X]->pNextTransferDescriptor : 0x%08X\n", (UINT32) pTempTransferDescriptor, (UINT32) (pTempTransferDescriptor->pNextTransferDescriptor),0,0,0,0); /* Display the end of buffer pointer for this transfer descriptor */ OS_PRINTF( "[0x%08X]->pEndOfBuffer : 0x%08X\n", (UINT32) pTempTransferDescriptor, (UINT32) (pTempTransferDescriptor->pEndOfBuffer),0,0,0,0); return; } /* End of function usbOhciDumpGeneralTransferDescriptor () *//***************************************************************************** usbOhciDumpPendingTransfers - dump pending transfers** This function is used to dump the pending transfers for the endpoint ** PARAMETERS: <pEndpointDescriptor (IN)> - Pointer to the endpoint descriptor* to be dumped** RETURNS: N/A** ERRNO:* None.*/VOID usbOhciDumpPendingTransfers ( PVOID pEndpointDescriptor ) { /* To hold the pointer to the OHCI endpoint descriptor */ PUSB_OHCI_ENDPOINT_DESCRIPTOR pOhciEndpointDescriptor = NULL; /* To hold the pointer to the current URB list element */ PUSB_OHCI_URB_LIST pCurrentUrbListElement = NULL; /* Check whether the parameter is valid */ if (pEndpointDescriptor == NULL) { return; } /* Initialize the pointer to the OHCI endpoint descriptor */ pOhciEndpointDescriptor = (PUSB_OHCI_ENDPOINT_DESCRIPTOR) pEndpointDescriptor; /* Initialize the pointer to the current URB list element */ pCurrentUrbListElement = pOhciEndpointDescriptor->pUrbListHead; /* Display the pending transfer information */ while (pCurrentUrbListElement != NULL) { /* Display the pointer to the URB */ OS_PRINTF( "[0x%08X]->pUrb : 0x%08X\n", (UINT32) pCurrentUrbListElement, (UINT32) (pCurrentUrbListElement->pUrb),0,0,0,0); /* * Display the pointer to the first transfer descriptor corresponding * to the URB. */ OS_PRINTF( "[0x%08X]->pTransferDescriptorListHead : 0x%08X\n", (UINT32)pCurrentUrbListElement, (UINT32)(pCurrentUrbListElement->pTransferDescriptorListHead),0,0,0,0); /* * Display the pointer to the first transfer descriptor corresponding * to the URB. */ OS_PRINTF( "[0x%08X]->pTransferDescriptorListTail : 0x%08X\n", (UINT32)pCurrentUrbListElement, (UINT32)(pCurrentUrbListElement->pTransferDescriptorListTail),0,0,0,0); /* Traverse to the next element in the list of URBs */ pCurrentUrbListElement = pCurrentUrbListElement->pNext; } /* End of while (pCurrentUrbListElement != NULL) */ return; } /* End of function usbOhciDumpPendingTransfers () *//**************************************************************************** usbOhciInitializeModuleTestingFunctions - obtaines entry points** Function to obtain the entry points used for HCD module testing.** RETURNS: N/A** ERRNO: none*/VOID usbOhciInitializeModuleTestingFunctions ( PUSBHST_HC_DRIVER_TEST pHCDriverTestEntryPoints /* Ptr to HCD module entry points */ ) { /* Check whether the parameter is valid */ if (NULL == pHCDriverTestEntryPoints) { return; } /* Clear the OHCI host controller driver entry functions information */ OS_MEMSET(pHCDriverTestEntryPoints, 0, sizeof(USBHST_HC_DRIVER_TEST)); /* * Populate the function pointer to power on the ports on the host * controller */ pHCDriverTestEntryPoints->HCD_PowerOnPorts = usbOhciPowerOnPorts; /* Function to reset the port on the host controller */ pHCDriverTestEntryPoints->HCD_ResetPort = usbOhciResetPort; /* Function to wait for a device connection on the host controller */ pHCDriverTestEntryPoints->HCD_WaitForConnection = usbOhciWaitForConnection; /* * Function to check the speed of the device connected to the host * controller */ pHCDriverTestEntryPoints->HCD_GetDeviceSpeed = usbOhciGetDeviceSpeed; return; } /* End of function usbOhciInitializeModuleTestingFunctions() *//***************************************************************************** usbOhciPowerOnPorts - power on the downstream ports** This function is used to power on the downstream ports of the USB OHCI* host controller. ** PARAMETERS: <uHostControllerIndex (IN)> - Specifies the host controller index** RETURNS: N/A** ERRNO:* None**\NOMANUAL*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -