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

📄 usbuhcdscheduleqwaitforsignal.c

📁 usb2 driver for vxwokrs
💻 C
📖 第 1 页 / 共 3 页
字号:
    /* Process the isochronous transfer request completion - Start */    /* Initialise the previous request pointer */    iPrevious = NULL;    /*     * Initialise the current request to     * be the head of the isochronous request queue     */    iRequest = pHCDData->usbUhcdIsoRequestQ;    /* This loop gets executed till all the isochronous requests are serviced */    while (iRequest != NULL )        {       /* Invalidate the cache */       DMA_INVALIDATE(iRequest->tail, sizeof(USB_UHCD_TD));        /* Check if the transfer is complete */        if (( USB_UHCD_SWAP_DATA(pHCDData->busIndex, iRequest->tail->dWord1Td) & USBUHCD_TDCS_STS_ACTIVE	) == 0)            {            USB_UHCD_LOG_MESSAGE ("Transfer complete\n");            /* Fill up status of the transfer */            usbUhcdFillIsoStatus(pHCDData->busIndex, USBHST_SUCCESS,                                 iRequest->pUrb,                                 iRequest);            /* Fill up transfer length */            usbUhcdGetIsoTransferLength (pHCDData->busIndex, iRequest);            USER_FLUSH(iRequest->pUrb, sizeof(USBHST_URB));            /* Unlink the isochrnous TDs and free them */            usbUhcdUnlinkItds (pHCDData,                               iRequest->head,                               TRUE);            /* Swap the data */            if (iRequest->pUrb->pTransferBuffer != NULL)                  USB_UHCD_SWAP_BUFDATA( pHCDData->busIndex,                                       iRequest->pUrb->pTransferBuffer,                                       iRequest->pUrb->uTransferLength);            /* Create a name for the callback handler */            sprintf (cbName, "u_isoCB%d", ncbNum++);            /* Spawn the callback function */            OS_CREATE_THREAD(cbName,                       95,                       iRequest->pUrb->pfCallback,                             iRequest->pUrb);            /* Check if this is the 1st request in the req queue */            if (iPrevious == NULL)                {                USB_UHCD_LOG_MESSAGE ("First request in the queue\n");                /* Update the isochronous queue head */                pHCDData->usbUhcdIsoRequestQ = iRequest->next;                }            /* This is not the first request in the request queue */            else                {                USB_UHCD_LOG_MESSAGE ("Update pointers\n");                /* Update the next pointers */                iPrevious->next = iRequest->next;                }            /* Copy the next pointer to a local pointer */            iTemporary = iRequest->next;            /* Free the isochronous request block */            OS_FREE(iRequest);            /*             * Copy the temporary pointer to the iRequest pointer. This would             * be used in the next iteration of the loop             */            iRequest = iTemporary;            }        /* If the transfer is not complete */        else            {            USB_UHCD_LOG_MESSAGE ("Transfer not complete\n");            /* Update the previous pointer */            iPrevious = iRequest;            /*             * Update the current queue pointer. This would             * be used in the next iteration of the loop             */            iRequest = iRequest->next;            }        }/* End of while () */    /* Process the isochronous transfer request completion - End */    USB_UHCD_LOG_MESSAGE ("usbUhcdProcessCompletedTds()\n");    }/* End of usbUhcdProcessCompletedTds() *//***************************************************************************** usbUhcdProcessIsocTds - handles the isoc TDs maked for deletion** This routine handles the isoc TDs maked for deletion.** RETURNS: N/A** ERRNO:*   None.** \NOMANUAL*/VOID usbUhcdProcessIsocTds    (    PUHCD_DATA pHCDData    )    {    /* For parsign the list of Isco request */     USB_UHCD_ISO_REQUEST_QUEUE * iPrevious ,*iRequest, *iTemporary;   /* To hold the task name of the callback function */    char cbName[20];    /* To hold the number of tasks created */    static UINT ncbNum=0;    /* Process the isochronous transfer request completion  */    /* Initialise the previous request pointer */    iPrevious = NULL;    /*     * Initialise the current request to     * be the head of the isochronous request queue     */    iRequest = pHCDData->usbUhcdIsoRequestQ;    OS_LOG_MESSAGE_MEDIUM(UHCD,"Entering usbUhcdProcessIsocTds()\n",0,0,0,0);    /* This loop gets executed till all the isochronous requests are serviced */    while (iRequest != NULL )        {        /* Check if the transfer is complete or the request is marked for deletion */        DMA_INVALIDATE(iRequest->tail, sizeof(USB_UHCD_TD));        if ((iRequest->markedForDeletion) && ((USB_UHCD_SWAP_DATA(pHCDData->busIndex, iRequest->tail->dWord1Td) & USBUHCD_TDCS_STS_ACTIVE	) != 0 ))            {            OS_LOG_MESSAGE_MEDIUM(UHCD,"Request marked for deletion \n",0,0,0,0);            /* Unlink the isochrnous TDs */            usbUhcdUnlinkItds (pHCDData,                               iRequest->head,                               TRUE);          /* update the staus of the urb as transfer cancelled */            iRequest->pUrb->nStatus = USBHST_TRANSFER_CANCELLED;            USER_FLUSH(iRequest->pUrb, sizeof(USBHST_URB));            /* Swap the data */            if (iRequest->pUrb->pTransferBuffer != NULL)                  USB_UHCD_SWAP_BUFDATA( pHCDData->busIndex,                                       iRequest->pUrb->pTransferBuffer,                                       iRequest->pUrb->uTransferLength);            if (iRequest->pUrb->pfCallback != NULL)                {                /* Create a name for the callback handler */                sprintf (cbName, "u_isoCB%d", ncbNum++);                /* Spawn the callback function */                OS_CREATE_THREAD(cbName,                                 95,                                 iRequest->pUrb->pfCallback,                                 iRequest->pUrb);                }            /* Check if this is the 1st request in the req queue */            if (iPrevious == NULL)                {                OS_LOG_MESSAGE_MEDIUM(UHCD,"First request in the queue\n",0,0,0,0);                /* Update the isochronous queue head */                pHCDData->usbUhcdIsoRequestQ = iRequest->next;                }            /* This is not the first request in the request queue */            else                {                OS_LOG_MESSAGE_MEDIUM(UHCD,"Update pointers\n",0,0,0,0);                /* Update the next pointers */                iPrevious->next = iRequest->next;                }            /* Copy the next pointer to a local pointer */            iTemporary = iRequest->next;            /* Free the isochronous request block */            OS_FREE(iRequest);            /*             * Copy the temporary pointer to the iRequest pointer. This would             * be used in the next iteration of the loop             */            iRequest = iTemporary;            }        /* If the transfer is not complete */        else            {            OS_LOG_MESSAGE_MEDIUM(UHCD,"Request not marked for deletion \n",0,0,0,0);            /* Update the previous pointer */            iPrevious = iRequest;            /*             * Update the current queue pointer. This would             * be used in the next iteration of the loop             */            iRequest = iRequest->next;            }        }/* End of while () */    /* Process the isochronous transfer request completion */    OS_LOG_MESSAGE_MEDIUM(UHCD," Exiting usbUhcdProcessIsocTds()\n",0,0,0,0);    }/***************************************************************************** usbUhcdCleartdOnSysError - handles the Host Controller Process error.** This routine handles the Host Controller Process error.** RETURNS: N/A** ERRNO:*   None.** \NOMANUAL*/void usbUhcdCleartdOnSysError    (    PUHCD_DATA pHCDData    )    {    /* To hold the pointer to the HCD maintained data structure */    USB_UHCD_NON_ISO_REQUEST_QUEUE * tempReq = NULL;    USB_UHCD_NON_ISO_REQUEST_QUEUE * delReq = NULL;    USB_UHCD_ISO_REQUEST_QUEUE * tempIsoReq = NULL;    USB_UHCD_ISO_REQUEST_QUEUE * delIsoReq = NULL;    if (pHCDData)    {        /* Consider the following scenario that the         * requests which have been serviced before this interrupt         * has occured, but their respective callback has not been called.         *         * for such requests, callback fucntion needs to be called.         * This task is accomplished by calling the usbUhcdProcessCompletedTds()         * function.         */        usbUhcdProcessCompletedTds(pHCDData);        /* Now for the remaining the requests, that has not been yet serviced by         * the host controller, needs to be cancelled, and the memory allocated         * for these ones needs to be freed. */        /* deallocate the non ischronous request blocks */        tempReq = pHCDData->usbUhcdNonIsoRequestQ;        while (tempReq)        {            delReq = tempReq;            tempReq = tempReq->next;            if (delReq->head && delReq->tail)                usbUhcdFreeTds(delReq->head, delReq->tail);            OS_FREE(delReq);        }        pHCDData->usbUhcdNonIsoRequestQ = NULL;                  /* deallocate the ischronous request blocks */        tempIsoReq = pHCDData->usbUhcdIsoRequestQ;        while (tempIsoReq)        {            delIsoReq = tempIsoReq;            tempIsoReq = tempIsoReq->next;            if (delIsoReq->head && delIsoReq->tail)                usbUhcdFreeTds (delIsoReq->head, delIsoReq->tail);            OS_FREE(delIsoReq);        }              pHCDData->usbUhcdIsoRequestQ = NULL;     }    else    {        OS_LOG_MESSAGE_MEDIUM(UHCD,"Passed HCD Pointer is NULL\n",0,0,0,0);    }    return;}/********************** End of File usbUhcdScheduleQwaitForSignal.c *************/

⌨️ 快捷键说明

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