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

📄 usbtcdisp1582interrupt.c

📁 This the compressed USB driver source code for vxworks5.6. It has device controller driver and other
💻 C
📖 第 1 页 / 共 3 页
字号:
* usbTcdIsp1582FncInterruptStatusClear - implements TCD_FNC_INTERRUPT_CLEAR** This function clears the interrupt status bits.** RETURNS : OK or ERROR, if the interrupt status is not cleared successfully.** ERRNO:* \is* \i S_usbTcdLib_BAD_PARAM.* Bad parameter is passed.* \ie** \NOMANUAL*/LOCAL STATUS usbTcdIsp1582FncInterruptStatusClear    (    pTRB_INTERRUPT_STATUS_GET_CLEAR	pTrb	/* Trb to be executed */    )    {    pTRB_HEADER	pHeader = (pTRB_HEADER) pTrb;	/* TRB_HEADER */    pUSB_TCD_ISP1582_TARGET	pTarget = NULL; /* USB_TCD_ISP1582_TARGET */    UINT32	data32 = 0;    /* WindView Instrumentation */     USB_TCD_LOG_EVENT(USB_TCD_ISP1582_INTERRUPT,    "usbTcdIsp1582FncInterruptStatusClear entered...", USB_TCD_ISP582_WV_FILTER);       USBISP1582_DEBUG ("usbTcdIsp1582FncInterruptStatusClear: Entered...\n",    0,0,0,0,0,0);    /* Validate Parameters */    if ((pHeader == NULL) || (pHeader->trbLength < sizeof (TRB_HEADER)) ||        (pHeader->handle == NULL))        {        /* WindView Instrumentation */         USB_TCD_LOG_EVENT(USB_TCD_ISP1582_INTERRUPT,        "usbTcdIsp1582FncInterruptStatusClear exiting: Bad Parameter Received...",        USB_TCD_ISP582_WV_FILTER);           USBISP1582_ERROR ("usbTcdIsp1582FncInterruptStatusClear : \        Bad Parameters...\n",0,0,0,0,0,0);        return ossStatus (S_usbTcdLib_BAD_PARAM);        }    pTarget =  (pUSB_TCD_ISP1582_TARGET) pHeader->handle;    /*     * Check whether interrupt is pending on reset event, suspend event,     * resume event or endpoint. If so, clear appropiate bits in interrupt     * register. If the interrupt is pending on any endpoint, clear for all     * the endpoints on which interrupts are pending. Also clears the     * dma and set interrutps.     */    if ((pTrb->uInterruptStatus & USBTCD_RESET_INTERRUPT_MASK) != 0)        {        /* Reset event has occured. Clear bit 0 on interrupt register */        data32 |= ISP1582_INT_REG_BRST;        }    if ((pTrb->uInterruptStatus & USBTCD_SUSPEND_INTERRUPT_MASK) != 0)        {        /* Suspend event has occured. Clear bit 3 on interrupt register */        data32 |= ISP1582_INT_REG_SUSP;        }    if ((pTrb->uInterruptStatus & USBTCD_RESUME_INTERRUPT_MASK) != 0)        {        /* Resume event has occured. Clear bit 4 on interrupt register */        data32 |= ISP1582_INT_REG_RESM;        }    if ((pTrb->uInterruptStatus & USBTCD_ENDPOINT_INTERRUPT_MASK) != 0)        {        /* Check whether endpoint Interppt is pending */        if (pTarget->setupIntPending)            data32 |= ISP1582_INT_REG_EP0SETUP;        /* Check whether endpoint Interrupt is pending */        if (pTarget->dmaEot)            data32 |= ISP1582_INT_REG_DMA;        /*          * Endpoint event has occured. Reset inturrupts for endpoint which         * are captured in endptPending member         */        if (pTarget->endptIntPending != 0)            data32 |= ISP1582_INT_REG_ENDPT_SET (pTarget->endptIntPending);        }    USBISP1582_DEBUG ("usbTcdIsp1582FncInterruptStatusGet: Interrupt to be \    cleared is %d...\n",data32,0,0,0,0,0);  if (data32 != 0)        {    	isp1582Write32 (pTarget , ISP1582_INT_REG , data32);        }    /* WindView Instrumentation */     USB_TCD_LOG_EVENT(USB_TCD_ISP1582_INTERRUPT,    "usbTcdIsp1582FncInterruptStatusClear exiting...", USB_TCD_ISP582_WV_FILTER);       USBISP1582_DEBUG ("usbTcdIsp1582FncInterruptStatusClear: Exiting...\n",    0,0,0,0,0,0);    return OK;    }/********************************************************************************* usbTcdIsp1582FncEndpointIntStatusGet - implements TCD_FNC_ENDPOINT_INTERRUPT_STATUS_GET** This function returns the interrupt status on an endpoint. It also checks* whether the particular endpoint on which interrupt occured is stalled or not.** RETURNS: OK or ERROR, if not able to get the endpoint interrupt status.** ERRNO:* \is* \i S_usbTcdLib_BAD_PARAM.* Bad parameter is passed.* \ie** \NOMANUAL*/LOCAL STATUS usbTcdIsp1582FncEndpointIntStatusGet    (    pTRB_ENDPOINT_INTERRUPT_STATUS_GET	pTrb		/* Trb to be executed */    )    {    pTRB_HEADER	pHeader = (pTRB_HEADER) pTrb;		/* TRB_HEADER */    pUSB_TCD_ISP1582_TARGET	pTarget = NULL;	    /* USB_TCD_ISP1582_TARGET */    pUSB_TCD_ISP1582_ENDPOINT	pEndpointInfo = NULL;/*USB_TCD_ISP1582_ENDPOINT*/    UINT8	endpointIndex = 0;			/* endpoint index */    UINT8	direction = 0;				/* direction */    BOOL	endptPending = FALSE;	     /* endpoint interrupt is pending */        /* WindView Instrumentation */     USB_TCD_LOG_EVENT(USB_TCD_ISP1582_INTERRUPT,    "usbTcdIsp1582FncEndpointIntStatusGet entered...", USB_TCD_ISP582_WV_FILTER);       USBISP1582_DEBUG ("usbTcdIsp1582FncEndpointIntStatusGet: Entered...\n",    0,0,0,0,0,0);    /* Validate Parameters */    if ((pHeader == NULL) || (pHeader->trbLength < sizeof (TRB_HEADER)) ||        (pHeader->handle == NULL) || (pTrb->pipeHandle ==0))        {        /* WindView Instrumentation */         USB_TCD_LOG_EVENT(USB_TCD_ISP1582_INTERRUPT,        "usbTcdIsp1582FncEndpointIntStatusGet exiting: Bad Parameter Received...",        USB_TCD_ISP582_WV_FILTER);           USBISP1582_ERROR ("usbTcdIsp1582FncEndpointIntStatusGet : \        Bad Parameters...\n",0,0,0,0,0,0);        return ossStatus (S_usbTcdLib_BAD_PARAM);        }    pTarget =  (pUSB_TCD_ISP1582_TARGET) pHeader->handle;    pEndpointInfo = (pUSB_TCD_ISP1582_ENDPOINT)pTrb->pipeHandle;    /* Determine the endpoint index and direction */    endpointIndex = pEndpointInfo->endpointIndex;    direction = pEndpointInfo->direction;    /* Determine if setup interrupt is pending on the control OUT endpoint */    if ((pTarget->endptIntPending & (1 << endpointIndex)) != 0)        {        if ((pEndpointInfo->isDoubleBufSup))            {            /* Initialize the endpoint index register */            isp1582Write8 (pTarget , ISP1582_ENDPT_INDEX_REG , endpointIndex);            if (((direction == USB_ENDPOINT_IN) &&                ((isp1582Read8 (pTarget,ISP1582_BUF_STATUS_REG) &                  ISP1582_BUF_STATUS_REG_MASK) ==                   ISP1582_BUF_STATUS_REG_BOTH_EMPT)) ||               ((direction == USB_ENDPOINT_OUT) &&                ((isp1582Read8 (pTarget ,ISP1582_BUF_STATUS_REG) &                  ISP1582_BUF_STATUS_REG_MASK) ==                   ISP1582_BUF_STATUS_REG_ONE_FILL)))                /* Interrupt is pending on that endpoint. Update endptPending */                pTarget->endptIntPending &= ~(1 << endpointIndex);            }            else            /* Interrupt is pending on that endpoint. Update endptPending */            pTarget->endptIntPending &= ~(1 << endpointIndex);        /* Interrupt is pending on that endpoint */        endptPending = TRUE;        }    else if ((endpointIndex == ISP1582_ENDPT_0_RX) &&        (pTarget->setupIntPending))        endptPending = TRUE;    if (endptPending)        {        USBISP1582_DEBUG ("usbTcdIsp1582FncEndpointIntStatusGet: Interrupt \        Pending on Endpoint %d...\n",endpointIndex,0,0,0,0,0);        /*         * Interrupt is pending on the endpoint. Set bit 0 of         * uEndptInterruptStatus saying that endpoint interrupt is pending.         */        pTrb->uEndptInterruptStatus = USBTCD_ENDPOINT_INTERRUPT_PENDING_MASK;        /* Determine the direction and update bits 2 & 3 accordingly */        if (direction == USB_ENDPOINT_OUT)            {            if ((pTarget->setupIntPending) &&                 (endpointIndex == ISP1582_ENDPT_0_RX))                /* Setup Interrupt is pending, update bit 1  */                pTrb->uEndptInterruptStatus |= USBTCD_ENDPOINT_SETUP_PID_MASK;            else                pTrb->uEndptInterruptStatus |= USBTCD_ENDPOINT_OUT_PID_MASK;            }        else            {            pTrb->uEndptInterruptStatus |= USBTCD_ENDPOINT_IN_PID_MASK;            /*             * If this is the last IN interrupt for the data stage and the             * status stage is to be initiated, then initiate a status stage             */                        if ((endpointIndex == ISP1582_ENDPT_0_TX) &&                pTarget->controlOUTStatusPending)                {                 UINT8 data = 0;                /* Select OUT endpoint for initiating a status stage */                isp1582Write8 (pTarget , ISP1582_ENDPT_INDEX_REG ,                                                         ISP1582_ENDPT_0_RX);                /* Initiate the status stage  */                data = isp1582Read8 (pTarget , ISP1582_CNTL_FUNC_REG);                isp1582Write8 (pTarget , ISP1582_CNTL_FUNC_REG ,                                          data | ISP1582_CNTL_FUNC_REG_STATUS);                pTarget->controlOUTStatusPending = FALSE;                }                     }        /*         * Determine whether the endpoint is stalled or not by reading the         * Control Function Register. If so update bit 17 of         * uEndptInterruptStatus.         */        /* Initialize the endpoint index register */        isp1582Write8 (pTarget , ISP1582_ENDPT_INDEX_REG , endpointIndex);        /* Read endpoint control function register */        if ((isp1582Read8 (pTarget , ISP1582_CNTL_FUNC_REG) &                                             ISP1582_CNTL_FUNC_REG_STALL) != 0)            {            /* Endpoint is stalled */            pTrb->uEndptInterruptStatus |= USBTCD_ENDPOINT_STALL_ERROR;            }        }    /* WindView Instrumentation */     USB_TCD_LOG_EVENT(USB_TCD_ISP1582_INTERRUPT,    "usbTcdIsp1582FncEndpointIntStatusGet exiting...", USB_TCD_ISP582_WV_FILTER);       USBISP1582_DEBUG ("usbTcdIsp1582FncEndpointIntStatusGet: Exiting...\n",    0,0,0,0,0,0);    return OK;    }/********************************************************************************* usbTcdIsp1582FncEndpointIntStatusClear - implements TCD_FNC_ENDPOINT_INTERRUPT_STATUS_CLEAR** This function clears the interrupt on an endpoint.** RETURNS: OK or ERROR, if not able to clear the endpoint interrupt status.** ERRNO:* \is* \i S_usbTcdLib_BAD_PARAM*  Bad paramter is passed.* \ie** \NOMANUAL*/LOCAL STATUS usbTcdIsp1582FncEndpointIntStatusClear    (    pTRB_ENDPOINT_INTERRUPT_STATUS_CLEAR	pTrb	/* Trb to be executed */    )    {    pTRB_HEADER	pHeader = (pTRB_HEADER) pTrb;		/* TRB_HEADER */    pUSB_TCD_ISP1582_TARGET	pTarget = NULL;	/* USB_TCD_ISP1582_TARGET */    pUSB_TCD_ISP1582_ENDPOINT	pEndpointInfo = NULL;/*USB_TCD_ISP1582_ENDPOINT*/    UINT8	endpointIndex = 0;		/* endpoint index */

⌨️ 快捷键说明

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