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

📄 usbtcdpdiusbd12interrupt.c

📁 This the compressed USB driver source code for vxworks5.6. It has device controller driver and other
💻 C
📖 第 1 页 / 共 2 页
字号:
                    USBPDIUSBD12_DEBUG("usbTcdPdiusbd12FncEndpointIntStatusGet:\                    OverFlow Error...\n",0,0,0,0,0,0);                    pTrb->uEndptInterruptStatus |= USBTCD_ENDPOINT_DATA_OVERRUN;                    break;                case D12_CMD_RLTS_ERROR_BITSTUFF :                    USBPDIUSBD12_DEBUG("usbTcdPdiusbd12FncEndpointIntStatusGet:\                    Bit Stuff Error...\n",0,0,0,0,0,0);                    pTrb->uEndptInterruptStatus |=                                                USBTCD_ENDPOINT_BIT_STUFF_ERROR;                    break;                default :            		USBPDIUSBD12_ERROR("usbTcdPdiusbd12FncEndpointIntStatusGet:\                    Wrong Error Code received...\n",0,0,0,0,0,0);                }            }        }    /* WindView Instrumentation */    USB_TCD_LOG_EVENT(USB_TCD_PDIUSBD12_INTERRUPT,    "usbTcdPdiusbd12FncEndpointIntStatusGet exiting...",    USB_TCD_PDIUSBD12_WV_FILTER);       USBPDIUSBD12_DEBUG ("usbTcdPdiusbd12FncEndpointIntStatusGet: Exiting \    ...\n",0,0,0,0,0,0);    return OK;    }/********************************************************************************* usbTcdPdiusbd12FncEndpointIntStatusClear - to clear the endpoint interrupt** This function clear the interrupt status of the endpoint.** RETURNS : OK or ERROR, if not able to clear the endpoint interrupt status.** ERRNO:*  none.** \NOMANUAL*/LOCAL STATUS usbTcdPdiusbd12FncEndpointIntStatusClear    (    pTRB_ENDPOINT_INTERRUPT_STATUS_CLEAR	pTrb	/* TRB to be executed */    )    {    pTRB_HEADER	pHeader = (pTRB_HEADER) pTrb;		/* TRB_HEADER */    pUSB_TCD_PDIUSBD12_TARGET	pTarget = NULL;   /* USB_TCD_PDIUSBD12_TARGET */    pUSB_TCD_PDIUSBD12_ENDPOINT pEndpoint = NULL;/*USB_TCD_PDIUSBD12_ENDPOINT */    USBPDIUSBD12_DEBUG ("usbTcdPdiusbd12FncEndpointIntStatusClear: Entered \    ...\n",0,0,0,0,0,0);    /* WindView Instrumentation */    USB_TCD_LOG_EVENT(USB_TCD_PDIUSBD12_INTERRUPT,    "usbTcdPdiusbd12FncEndpointIntStatusClear entered...",    USB_TCD_PDIUSBD12_WV_FILTER);       /* Validate Parameters */    if ((pHeader == NULL) || (pHeader->trbLength < sizeof (TRB_HEADER)) ||        (pTrb->pipeHandle == 0))        {        /* WindView Instrumentation */        USB_TCD_LOG_EVENT(USB_TCD_PDIUSBD12_INTERRUPT,        "usbTcdPdiusbd12FncEndpointIntStatusClear exiting:Bad Parameters \        Received", USB_TCD_PDIUSBD12_WV_FILTER);           USBPDIUSBD12_ERROR ( " usbTcdPdiusbd12FncEndpointIntStatusClear : \        Invalid parameters ...\n",0,0,0,0,0,0 );        return ossStatus (S_usbTcdLib_BAD_PARAM);        }    pTarget =  (pUSB_TCD_PDIUSBD12_TARGET) pHeader->handle;    pEndpoint = (pUSB_TCD_PDIUSBD12_ENDPOINT)pTrb->pipeHandle ;    /* Check for DMA EOT */    if (pTarget->dmaEot && pTarget->dmaInUse &&       (pEndpoint->endpointIndex == pTarget->dmaEndpointId))        {        if (pEndpoint->direction == USB_ENDPOINT_IN) /* Check this */            {            /* To disable the DMA  */            pTarget->dmaByte &= ~D12_CMD_SD_DMA_ENABLE;            USBPDIUSBD12_DEBUG ("usbTcdPdiusbd12FncEndpointIntStatusClear: \            Disabling the DMA...\n",0,0,0,0,0,0);            d12SetDma (pTarget);            }        pTarget->dmaEot = FALSE;       	pTarget->dmaInUse = FALSE;        /* Reseting the endpoint id */        pTarget->dmaEndpointId = 0;        }    /* WindView Instrumentation */    USB_TCD_LOG_EVENT(USB_TCD_PDIUSBD12_INTERRUPT,    "usbTcdPdiusbd12FncEndpointIntStatusClear exiting...",    USB_TCD_PDIUSBD12_WV_FILTER);       USBPDIUSBD12_DEBUG ("usbTcdPdiusbd12FncEndpointIntStatusClear: \    Exiting ...",0,0,0,0,0,0);    return OK;    }/********************************************************************************* usbTcdPdiusbd12FncInterruptStatusGet - to get the interrupt status** This function returns the interrupt status i.e whether the reset interrupt,* suspend interrupt, resume interrupt, disconnect interrupt or endpoint* related interrupt is pending.** RETURNS : OK or ERROR, if the interrupt status is not retrieved successfully.** ERRNO:*  None.** \NOMANUAL*/LOCAL STATUS usbTcdPdiusbd12FncInterruptStatusGet    (    pTRB_INTERRUPT_STATUS_GET_CLEAR	pTrb	/* TRB to be executed */    )    {    UINT16	readIntByte = 0;		/* Interrupt byte */    pTRB_HEADER pHeader = (pTRB_HEADER) pTrb;	/* TRB_HEADER */    pUSB_TCD_PDIUSBD12_TARGET	pTarget = NULL;	/* USB_TCD_PDIUSBD12_TARGET */    UINT8	ginByte = 0;			    UINT8	uIndex = 0;    /* WindView Instrumentation */    USB_TCD_LOG_EVENT(USB_TCD_PDIUSBD12_INTERRUPT,    "usbTcdPdiusbd12FncGetInterruptStatus entered...",    USB_TCD_PDIUSBD12_WV_FILTER);       USBPDIUSBD12_DEBUG ( "usbTcdPdiusbd12FncGetInterruptStatus : Entered \    ...\n",0,0,0,0,0,0);    /* Validate Parameters */    if ((pHeader == NULL) || (pHeader->trbLength < sizeof (TRB_HEADER)))        {        /* WindView Instrumentation */        USB_TCD_LOG_EVENT(USB_TCD_PDIUSBD12_INTERRUPT,        "usbTcdPdiusbd12FncInterruptStatusGet exiting:Bad Parameters \        Received", USB_TCD_PDIUSBD12_WV_FILTER);           USBPDIUSBD12_ERROR ( " usbTcdPdiusbd12FncGetInterruptStatus : \        Invalid parameters ...\n",0,0,0,0,0,0 );        return ossStatus (S_usbTcdLib_BAD_PARAM);        }    pTarget =  (pUSB_TCD_PDIUSBD12_TARGET) pHeader->handle;    USBPDIUSBD12_DEBUG ( "usbTcdPdiusbd12FncGetInterruptStatus : Reading the \    Interrupt Status Register ...\n",0,0,0,0,0,0);    /* read Interrupt Status Register */    readIntByte = d12ReadIntReg (pTarget);    /* Reseting the uInterruptStatus flag */    pTrb->uInterruptStatus = 0;    /* Checking for the type of interrupt occured */    if ((readIntByte & D12_CMD_RIR_ENDPOINT_INT_MASK) != 0 )        {        /* WindView Instrumentation */        USB_TCD_LOG_EVENT(USB_TCD_PDIUSBD12_INTERRUPT,        "usbTcdPdiusbd12FncInterruptStatusGet: Endpoint related event occured",        USB_TCD_PDIUSBD12_WV_FILTER);           USBPDIUSBD12_DEBUG ( "usbTcdPdiusbd12FncGetInterruptStatus : \        Endpoint Interrupt has occured...\n",0,0,0,0,0,0);        /* Store the endpoint whcih generated the interrupt */        pTarget->endptIntPending |= (readIntByte & D12_CMD_RIR_ENDPOINT_INT_MASK);        /* Update uInterruptStatus */        pTrb->uInterruptStatus |= USBTCD_ENDPOINT_INTERRUPT_MASK ;        /*         * Read the last transaction status of the endpoints on which interrupts         * are pending. This is done as the interrupt status bits are cleared         * only on reading the last transaction status. The reason for storing         * is because the contents are lost once the last transaction         * status is read.         */         for (uIndex = 0; uIndex < D12_NUM_ENDPOINTS; uIndex++)            {            if ((readIntByte & (0x01 << uIndex)) != 0)                pTarget->uLastTransactionStatus[uIndex] |=                                    d12ReadLastTransStatusByte(pTarget , uIndex);            }        }    if ((readIntByte & D12_CMD_RIR_BUS_RESET) != 0)        {        ginByte = IN_EVAL_GIN (pTarget);        /* Follow-up by determining if Vbus is present or not */        if ((ginByte & D12EVAL_BUS_POWER) == 0)            {            pTrb->uInterruptStatus |= USBTCD_DISCONNECT_INTERRUPT_MASK;     	    USBPDIUSBD12_DEBUG ( "usbTcdPdiusbd12FncGetInterruptStatus : \      	          Device is disconnected...\n",0,0,0,0,0,0);            }        else            {    	    pTrb->uInterruptStatus |= USBTCD_RESET_INTERRUPT_MASK ;     	    USBPDIUSBD12_DEBUG ( "usbTcdPdiusbd12FncGetInterruptStatus : Bus \      	          Reset has occured...\n",0,0,0,0,0,0);            }        }    /*  Suspend/Resume event has occured */    if ((readIntByte & D12_CMD_RIR_SUSPEND) != 0)        {        UINT8  gInByte = IN_EVAL_GIN (pTarget);        if ((gInByte & D12EVAL_SUSPEND) == 0)             {            /* WindView Instrumentation */            USB_TCD_LOG_EVENT(USB_TCD_PDIUSBD12_INTERRUPT,            "usbTcdPdiusbd12FncInterruptStatusGet: Resume Event",            USB_TCD_PDIUSBD12_WV_FILTER);   	    /* Resume event has occured */	            USBPDIUSBD12_DEBUG ( "usbTcdPdiusbd12FncGetInterruptStatus : \            Resume Event has occured...\n",0,0,0,0,0,0);            pTrb->uInterruptStatus |= USBTCD_RESUME_INTERRUPT_MASK;            }        else                          {            /* Suspend event has occured */            /* WindView Instrumentation */            USB_TCD_LOG_EVENT(USB_TCD_PDIUSBD12_INTERRUPT,            "usbTcdPdiusbd12FncInterruptStatusGet: Suspend Event",            USB_TCD_PDIUSBD12_WV_FILTER);               USBPDIUSBD12_DEBUG ( "usbTcdPdiusbd12FncGetInterruptStatus : \            Suspend Event has occured...\n",0,0,0,0,0,0);            pTrb->uInterruptStatus |= USBTCD_SUSPEND_INTERRUPT_MASK;            }        }    /* Check for Dma Event */    if ((readIntByte & D12_CMD_RIR_DMA_EOT) != 0)        {        /* WindView Instrumentation */        USB_TCD_LOG_EVENT(USB_TCD_PDIUSBD12_INTERRUPT,        "usbTcdPdiusbd12FncInterruptStatusGet: DMA Related Event",        USB_TCD_PDIUSBD12_WV_FILTER);           USBPDIUSBD12_DEBUG ( "usbTcdPdiusbd12FncGetInterruptStatus : DMA \        Event has occured...\n",0,0,0,0,0,0);        pTrb->uInterruptStatus |= USBTCD_ENDPOINT_INTERRUPT_MASK;        pTarget->dmaEot = TRUE;        /*          * Set the bit indicating that an interrupt is pending on          * the endpoint.         */           pTarget->endptIntPending |= (0x01 << pTarget->dmaEndpointId);         /*         * Set the bit indicating that the dma transfer is          * success on the endpoint.         */        pTarget->uLastTransactionStatus[pTarget->dmaEndpointId] |=                                                  D12_CMD_RLTS_DATA_SUCCESS;        d12ReadLastTransStatusByte(pTarget , pTarget->dmaEndpointId);        }    /* WindView Instrumentation */    USB_TCD_LOG_EVENT(USB_TCD_PDIUSBD12_INTERRUPT,    "usbTcdPdiusbd12FncGetInterruptStatus exiting...",    USB_TCD_PDIUSBD12_WV_FILTER);       USBPDIUSBD12_DEBUG ( "usbTcdPdiusbd12FncGetInterruptStatus :Exiting \    ...\n",0,0,0,0,0,0);    return OK;    }    

⌨️ 快捷键说明

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