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

📄 usbtcdnet2280interrupt.c

📁 This the compressed USB driver source code for vxworks5.6. It has device controller driver and other
💻 C
📖 第 1 页 / 共 4 页
字号:
	pTrb->uInterruptStatus |= USBTCD_RESET_INTERRUPT_MASK;        }    /* disconnect interrupt */    if ((data32 & NET2280_IRQENB1_VBUS) != 0)        {        USB_NET2280_DEBUG ("usbTcdNET2280FncInterruptStatusGet: Change in VBUS \        occured...\n",0,0,0,0,0,0);        /* Read the USBCTL register and determine VBUS status */        if ((NET2280_CFG_READ (pTarget, NET2280_USBCTL_REG) &             NET2280_USBCTL_REG_VBUSPIN) == 0)            {            USB_NET2280_DEBUG ("usbTcdNET2280FncInterruptStatusGet: Disconnect \            Interrupt...\n",0,0,0,0,0,0);            /* WindView Instrumentation */            USB_TCD_LOG_EVENT(USB_TCD_NET2280_INTERRUPT,            "usbTcdNET2280FncInterruptStatusGet: Disconnect Event Occured...",            USB_TCD_NET2280_WV_FILTER);            /* set bit 0 of TRB :: uInterruptStatus */     	    pTrb->uInterruptStatus |= USBTCD_DISCONNECT_INTERRUPT_MASK;            }        else            {            /* Reset the VBUS Interrupt */            NET2280_CFG_WRITE (pTarget, NET2280_IRQSTAT1_REG,                               NET2280_IRQENB1_VBUS);            }        }    /* control status interrupt */    if ((data32 & NET2280_IRQENB1_CS) != 0)        {        /* To temporarily store the setupData */         UINT32 setupData = 0;        /* WindView Instrumentation */         USB_TCD_LOG_EVENT(USB_TCD_NET2280_INTERRUPT,        "usbTcdNET2280FncInterruptStatusGet: Control Status Stage:.",        USB_TCD_NET2280_WV_FILTER);           USB_NET2280_DEBUG ("usbTcdNET2280FncInterruptStatusGet: Control Status \        Interrupt...\n",0,0,0,0,0,0);        /* Read the first 4 bytes of the setup packet */        setupData = NET2280_CFG_READ (pTarget, NET2280_SETUP0123_REG);        /* Check if it is for set address request */        if ((setupData & 0xFF00) == 0x0500)            {            /* The most significant 16 bits give the address value to be set */                        setupData >>= 16;            /*             * This value will be written on a status stage completion.             * So set the Force Immediate bit to update the address value             * immediately.             */            setupData |= NET2280_OURADDR_REG_FI;            /* Store the data in pTarget data structure */            pTarget->addressTobeSet = setupData;            }          /*         * control status interrupt has occured. We need to clear the Control         * Status handshake bit of Endpoint Response Register for endpoint 0.         * This bit is automatically set a SETUP Packet is detected. Clearing         * it will result a proper response returned to the host         */        if ((NET2280_CFG_READ (pTarget, NET2280_EP_RSP_OFFSET (NET2280_ENDPT_0_OUT))              & NET2280_EP_RSP_CSPH) != 0)                {             /* Clear bit 3 of Endpoint Response Register */             NET2280_CFG_WRITE (pTarget, NET2280_EP_RSP_OFFSET (NET2280_ENDPT_0_OUT),                           NET2280_EP_RSP_CSPH);             }        /* Clear the Control Interrupt Status bit */        NET2280_CFG_WRITE (pTarget,NET2280_IRQSTAT1_REG, NET2280_IRQENB1_CS);        }    /* suspend interrupt */    if ((data32 &  NET2280_IRQENB1_SUSP) != 0)        {        /* SUSPEND EVENT HANDLING IS AN OPEN ISSUE .. NEED to BE HANDLED */        USB_NET2280_DEBUG ("usbTcdNET2280FncInterruptStatusGet: Suspend \        Interrupt...\n",0,0,0,0,0,0);        /* WindView Instrumentation */        USB_TCD_LOG_EVENT(USB_TCD_NET2280_INTERRUPT,        "usbTcdNET2280FncInterruptStatusGet: Suspend Event Occured...",        USB_TCD_NET2280_WV_FILTER);        /* Set bit 2 of TRB :: uInterruptStatus */        pTrb->uInterruptStatus |= USBTCD_SUSPEND_INTERRUPT_MASK;        }    /* resume event */    if ((data32 & NET2280_IRQENB1_RESM) != 0)        {        USB_NET2280_DEBUG ("usbTcdNET2280FncInterruptStatusGet: Resume \        Interrupt...\n",0,0,0,0,0,0);        /* WindView Instrumentation */        USB_TCD_LOG_EVENT(USB_TCD_NET2280_INTERRUPT,        "usbTcdNET2280FncInterruptStatusGet: Resume Event Occured...",        USB_TCD_NET2280_WV_FILTER);        /* Set bit 2 of TRB :: uInterruptStatus */        pTrb->uInterruptStatus |= USBTCD_RESUME_INTERRUPT_MASK;        }#ifdef NET2280_DMA_SUPPORTED    /* dma related event */    for (i = NET2280_ENDPT_A; i <= NET2280_ENDPT_D; i++)        {    	if ((data32 & NET2280_IRQENB1_DMA(i)) != 0)            {            /* Read the contents of EP_CFG register */            tempData = NET2280_CFG_READ (pTarget,                                           NET2280_EP_CFG_OFFSET(i));            /* Check if the dma is completed on an IN endpoint */            if ((tempData & NET2280_EP_CFG_DIRECTION) != 0)                {                /* Clear the data packet transmitted interrupt */                NET2280_CFG_WRITE (pTarget,                                   NET2280_EP_STAT_OFFSET(i),                                    NET2280_EP_STAT_DPT);                         /* Read the contents of EP_STAT register */                 tempData =  NET2280_CFG_READ (pTarget,                                           NET2280_EP_STAT_OFFSET(i));                /*                  * There are chances that the EOT is happenned, but the                 * FIFO still has some data to be sent to the host.                 * If this is the case, then this cannot be treated as                  * a completion of IN transfer. If FIFO is empty, then                 * IN transfer is completed. So, set the flag indicating                  * a transfer completion                 */                if ((tempData & NET2280_EP_STAT_FIFO_EMPTY) != 0)                    {                    /* Set appropiate bit in pTarget :: dmaEot */                    pTarget->dmaEot |= (1 << i);                    /* set bit 4 if TRB :: uInterruptStatus */                    pTrb->uInterruptStatus |= USBTCD_ENDPOINT_INTERRUPT_MASK;                     }                 else                     /*                      * The transfer is yet to be completed. The handling should be                      * endpoint interrupt handling section.                      */                    {                    /* Enable back the data packet transmitted interrupt */                    NET2280_CFG_WRITE (pTarget,                                       NET2280_EP_IRQENB_OFFSET(i),                                        NET2280_EP_IRQENB_DPT);                                                }                }               else                {                /* Set appropiate bit in pTarget :: dmaEot */                pTarget->dmaEot |= (1 << i);                /* set bit 4 if TRB :: uInterruptStatus */                pTrb->uInterruptStatus |= USBTCD_ENDPOINT_INTERRUPT_MASK;                }            /* Clear the dma interrupt */            NET2280_CFG_WRITE (pTarget,                   NET2280_DMASTAT_OFFSET(i),                  NET2280_DMASTAT_TD_INT);            }        }#endif    /* Power State Change Mode */    if ((data32 & NET2280_IRQENB1_PSCINTEN) != 0)        {        /* Clear this bit in IRQSTAT1 register */        NET2280_CFG_WRITE (pTarget, NET2280_IRQSTAT1_REG,                           NET2280_IRQENB1_PSCINTEN);        }    /* PCI Parity Error */    if ((data32 & NET2280_IRQENB1_PCIPARITYERR) != 0)        {        /* To be implemented */        /* Clear this bit in IRQSTAT1 register */        NET2280_CFG_WRITE (pTarget, NET2280_IRQSTAT1_REG,                           NET2280_IRQENB1_PCIPARITYERR);        }    USB_NET2280_DEBUG ("usbTcdNET2280FncInterruptStatusGet: Exiting...\n",    0,0,0,0,0,0);    return OK;    }/******************************************************************************** usbTcdNET2280FncInterruptStatusClear - 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 usbTcdNET2280FncInterruptStatusClear    (    pTRB_INTERRUPT_STATUS_GET_CLEAR pTrb	/* TRB to be executed */    )    {    pTRB_HEADER	pHeader = (pTRB_HEADER) pTrb;	/* TRB_HEADER */    pUSB_TCD_NET2280_TARGET	pTarget = NULL; /* USB_TCD_NET2280_TARGET */    /* WindView Instrumentation */    USB_TCD_LOG_EVENT (USB_TCD_NET2280_INTERRUPT,    "usbTcdNET2280FncInterruptStatusClear entered.",USB_TCD_NET2280_WV_FILTER);    USB_NET2280_DEBUG ("usbTcdNET2280FncInterruptStatusClear: 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_NET2280_INTERRUPT,        "usbTcdNET2280FncInterruptStatusClear exiting:Bad Param Received..\n",        USB_TCD_NET2280_WV_FILTER);        USB_NET2280_ERROR ("usbTcdNET2280FncInterruptStatusClear : \        Bad Parameters...\n",0,0,0,0,0,0);        return ossStatus (S_usbTcdLib_BAD_PARAM);        }    pTarget =  (pUSB_TCD_NET2280_TARGET) pHeader->handle;    /*     * Check whether interrupt is pending on disconnect event, 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.     */    /* disconncet event */    if ((pTrb->uInterruptStatus & USBTCD_DISCONNECT_INTERRUPT_MASK) != 0)        {         USB_NET2280_DEBUG ("usbTcdNET2280FncInterruptStatusClear:Clear VBUS \n",         0,0,0,0,0,0);        /* clear VBUS Interrupt */        NET2280_CFG_WRITE (pTarget, NET2280_IRQSTAT1_REG, NET2280_IRQENB1_VBUS);        }    /* reset event */    if ((pTrb->uInterruptStatus & USBTCD_RESET_INTERRUPT_MASK) != 0)        {        USB_NET2280_DEBUG ("usbTcdNET2280FncInterruptStatusClear:Clearing \        resetBit \n", 0,0,0,0,0,0);        /* clear Root Port Reset Interrupt Interrupt */        NET2280_CFG_WRITE (pTarget, NET2280_IRQSTAT1_REG,                           NET2280_IRQENB1_RPRESET);        }    /* suspend event */    if ((pTrb->uInterruptStatus & USBTCD_SUSPEND_INTERRUPT_MASK) != 0)        {	/* open issue */        }    /* resume event */    if ((pTrb->uInterruptStatus & USBTCD_RESUME_INTERRUPT_MASK) != 0)        {     	/* clear resume interrupt bit */         USB_NET2280_DEBUG ("usbTcdNET2280FncInterruptStatusClear: \         Clearing Resume Interrupt bit\n", 0,0,0,0,0,0);         NET2280_CFG_WRITE (pTarget, NET2280_IRQSTAT1_REG,                            NET2280_IRQENB1_RESM);        }    /* endpoint related event */    if ((pTrb->uInterruptStatus & USBTCD_ENDPOINT_INTERRUPT_MASK) != 0)

⌨️ 快捷键说明

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