📄 usbehcdeventhandler.c
字号:
*/ for (pTempRequestInfo = pEHCDData->pRequestQueueHead; (NULL != pTempRequestInfo) && (pRequestInfo != pTempRequestInfo->pListRequest); pTempRequestInfo = pTempRequestInfo->pListRequest); /* Assert if the request is not found */ OS_ASSERT(NULL != pTempRequestInfo); /* Unlink the request from the HCD list */ pTempRequestInfo->pListRequest = pRequestInfo->pListRequest; if (NULL == pTempRequestInfo->pListRequest) { pEHCDData->pRequestQueueTail = pTempRequestInfo; } } /* This is the head of the HCD request queue */ else { /* Update the head element */ pEHCDData->pRequestQueueHead = pRequestInfo->pListRequest; if (NULL == pEHCDData->pRequestQueueHead) { pEHCDData->pRequestQueueTail = NULL; } } /* Update the head of the pipe request queue */ pHCDPipe->pRequestQueueHead = pRequestInfo->pNext; /* Release the request synchronisation event */ OS_RELEASE_EVENT(pEHCDData->RequestSynchEventID); /* If the pipe is an interrupt pipe, add all * the TDs to the free QTD pool */ if (USBHST_INTERRUPT_TRANSFER == pHCDPipe->uEndpointType) { /* Pointer to the tail of Queue TD */ pUSB_EHCD_QTD pQTDTail = NULL; /* Pointer to the head of Queue TD */ pUSB_EHCD_QTD pQTDHead = NULL; /* Pointer to the temporary QTD */ pUSB_EHCD_QTD pTempQTD = NULL; /* Get the tail of the TD list */ pQTDTail = (pUSB_EHCD_QTD)pRequestInfo->pTail; /* Get the head of the TD list */ pQTDHead = (pUSB_EHCD_QTD)pRequestInfo->pHead; /* Assert if the head or tail is invalid */ OS_ASSERT(NULL != pQTDHead); OS_ASSERT(NULL != pQTDTail); /* Release all the TDs associated with this Request */ for (; pQTDHead != pQTDTail; pQTDHead = pTempQTD) { /* Store the next pointer temporarily */ pTempQTD = pQTDHead->pNext; /* Add the TD to the free list */ usbEhcdAddToFreeQTDList(pQTDHead); } /* Add the tail element to the list */ usbEhcdAddToFreeQTDList(pQTDTail); } /* This endpoint is an isochronous endpoint */ else { /* Check if the endpoint is for a full speed device. It would * contain split isochronous TDs */ if (USBHST_FULL_SPEED == pHCDPipe->uSpeed) { /* Pointer to the tail of SITD */ pUSB_EHCD_SITD pSITDTail = NULL; /* Pointer to the head of SITD */ pUSB_EHCD_SITD pSITDHead = NULL; /* Pointer to the temporary SITD */ pUSB_EHCD_SITD pTempSITD = NULL; /* Get the tail of the TD list */ pSITDTail = (pUSB_EHCD_SITD)pRequestInfo->pTail; /* Get the head of the TD list */ pSITDHead = (pUSB_EHCD_SITD)pRequestInfo->pHead; /* Assert if the head or tail is invalid */ OS_ASSERT(NULL != pSITDHead); OS_ASSERT(NULL != pSITDTail); /* Release all the TDs associated with this Request */ for (; pSITDHead != pSITDTail; pSITDHead = pTempSITD) { /* Store the next pointer temporarily */ pTempSITD = pSITDHead->pVerticalNext; /* Add the TD to the free list */ usbEhcdAddToFreeSITDList(pSITDHead); } /* Add the tail element to the list */ usbEhcdAddToFreeSITDList(pSITDTail); } /* Check if the endpoint is for a high speed device. It would * contain isochronous TDs */ else if (USBHST_HIGH_SPEED == pHCDPipe->uSpeed) { /* Pointer to the tail of ITD */ pUSB_EHCD_ITD pITDTail = NULL; /* Pointer to the head of ITD */ pUSB_EHCD_ITD pITDHead = NULL; /* Pointer to the temporary ITD */ pUSB_EHCD_ITD pTempITD = NULL; /* Get the tail of the TD list */ pITDTail = (pUSB_EHCD_ITD)pRequestInfo->pTail; /* Get the head of the TD list */ pITDHead = (pUSB_EHCD_ITD)pRequestInfo->pHead; /* Assert if the head or tail is invalid */ OS_ASSERT(NULL != pITDHead); OS_ASSERT(NULL != pITDTail); /* Release all the TDs associated with this Request */ for (; pITDHead != pITDTail; pITDHead = pTempITD) { /* Store the next pointer temporarily */ pTempITD = pITDHead->pVerticalNext; /* Add the TD to the free list */ usbEhcdAddToFreeITDList(pITDHead); } /* Add the tail element to the list */ usbEhcdAddToFreeITDList(pITDTail); } /* Invalid speed */ else { OS_LOG_MESSAGE_HIGH(EHCD,"usbEhcdCleanupPeriodicPipes - \ Invalid isochronous speed\n",0,0,0,0); OS_ASSERT(FALSE); } } /* Call the callback function if it is registered */ if (NULL != pRequestInfo->pUrb->pfCallback) { (pRequestInfo->pUrb->pfCallback)(pRequestInfo->pUrb); } /* Free the memory allocated for the request information */ OS_FREE(pRequestInfo); /* Exclusively access the request synchronisation list */ OS_WAIT_FOR_EVENT(pEHCDData->RequestSynchEventID, OS_WAIT_INFINITE); }/* End of for () */ /* Release the request synchronisation event */ OS_RELEASE_EVENT(pEHCDData->RequestSynchEventID); /* If it is a non-isochronous endpoint, release the QHs */ if (USBHST_INTERRUPT_TRANSFER == pHCDPipe->uEndpointType) { /* Assert if the QH is invalid */ OS_ASSERT(NULL != pHCDPipe->pQH); /* Add the QH to the free list */ usbEhcdAddToFreeQHList(pHCDPipe->pQH); } /* Release the event to the waiting task */ OS_RELEASE_EVENT(pHCDPipe->DeleteSynchEventID); /* Exclusively access the reclamation list */ OS_WAIT_FOR_EVENT(pEHCDData->ReclamationListSynchEventID, OS_WAIT_INFINITE); } /* Search the list which contains the requests which need to be removed * and release the memory allocated for all of them. */ for (pRequestInfo = pEHCDData->pHeadPeriodicCancelList; NULL != pRequestInfo; pRequestInfo = pEHCDData->pHeadPeriodicCancelList) { /* Update the head of the asynch request reclamation list */ pEHCDData->pHeadPeriodicCancelList = pRequestInfo->pListRequest; /* Release the exclusive access */ OS_RELEASE_EVENT(pEHCDData->ReclamationListSynchEventID); /* Assert if the pipe pointer is invalid */ OS_ASSERT(NULL != pRequestInfo->pHCDPipe); /* The following condition will check if the request is for an * interrupt endpoint and will remove the request elements. */ if (USBHST_INTERRUPT_TRANSFER == pRequestInfo->pHCDPipe->uEndpointType) { /* Pointer to the tail of Queue TD */ pUSB_EHCD_QTD pQTDTail = NULL; /* Pointer to the head of Queue TD */ pUSB_EHCD_QTD pQTDHead = NULL; /* Pointer to the temporary QTD */ pUSB_EHCD_QTD pTempQTD = NULL; /* Get the tail of the TD list */ pQTDTail = (pUSB_EHCD_QTD)pRequestInfo->pTail; /* Get the head of the TD list */ pQTDHead = (pUSB_EHCD_QTD)pRequestInfo->pHead; /* Assert if the head or tail is invalid */ OS_ASSERT(NULL != pQTDHead); OS_ASSERT(NULL != pQTDTail); /* Release all the TDs associated with this Request */ for (; pQTDHead != pQTDTail; pQTDHead = pTempQTD) { /* Store the next pointer temporarily */ pTempQTD = pQTDHead->pNext; /* Add the TD to the free list */ usbEhcdAddToFreeQTDList(pQTDHead); } /* Add the tail element to the list */ usbEhcdAddToFreeQTDList(pQTDTail); /* The status is updated to cancel in usbEhcdCancelURB() function. So * it is not updated to Cancelled here. */ } else if (USBHST_ISOCHRONOUS_TRANSFER == pRequestInfo->pHCDPipe->uEndpointType) { /* To be done for isochronous */ } else { OS_ASSERT(FALSE); } /* Release the semaphore to the waiting task */ OS_RELEASE_EVENT(pRequestInfo->pHCDPipe->DeleteSynchEventID); /* Free the memory allocated for the request information */ OS_FREE(pRequestInfo); /* Exclusively access the reclamation list */ OS_WAIT_FOR_EVENT(pEHCDData->ReclamationListSynchEventID, OS_WAIT_INFINITE); } /* Check if some request pending in Reclamation list or cancel list, if not disable the intr */ if ((NULL == pEHCDData->pPeriodicReclamationListHead) && (NULL == pEHCDData->pHeadPeriodicCancelList)) { USB_EHCD_CLR_BIT_USBINTR_INT_ON_FRAME_LIST_ROLLOVER(pEHCDData); } /* Release the exclusive access */ OS_RELEASE_EVENT(pEHCDData->ReclamationListSynchEventID); OS_LOG_MESSAGE_LOW(EHCD,"usbEhcdCleanupPeriodicPipes - Exit\n",0,0,0,0); return; }/* End of usbEhcdCleanupPeriodicPipes() *//***************************************************************************** usbEhcdHostSystemErrorHandler - handles the host system error interrupt** This is used to handle the host system error interrupt.** RETURNS: N/A.** ERRNO:* None.** \NOMANUAL*/LOCAL VOID usbEhcdHostSystemErrorHandler ( pUSB_EHCD_DATA pEHCDData ) { /* WindView Instrumentation */ USB_HCD_LOG_EVENT( USB_EHCI_WV_EVENT_HANDLER, "usbEhcdHostSystemErrorHandler() starts", USB_EHCD_WV_FILTER); OS_LOG_MESSAGE_LOW(EHCD,"usbEhcdHostSystemErrorHandler - Entry\n",0,0,0,0); /* Check the validity of the parameters */ if (NULL == pEHCDData) { OS_LOG_MESSAGE_HIGH(EHCD,"usbEhcdHostSystemErrorHandler - parameter not\ valid\n",0,0,0,0); return; } /* Stop the Host controller from processing the schedule */ USB_EHCD_CLR_BIT(pEHCDData, USBCMD, RS); OS_LOG_MESSAGE_LOW(EHCD,"usbEhcdHostSystemErrorHandler - Exit\n",0,0,0,0); return; }/* End of usbEhcdHostSystemErrorHandler() *//***************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -