?? usbtcdnet2280interrupt.c
字號:
*/ data32 = dataTemp; } } /* * If the transfer length is 0, then * do not notify an endpoint interrupt. * If we notify an interrupt, then HAL assumes that it is an * end of transfer and calls the callback function. */ if (pEndpointInfo->dataLength == 0) pTrb->uEndptInterruptStatus = 0; } /* if bit 21 is set, report TIMEOUT error to HAL */ if ((data32 & NET2280_EP_STAT_TIMEOUT) != 0) { pTrb->uEndptInterruptStatus |= USBTCD_ENDPOINT_TIMEOUT_ERROR; } /* * If NAKOUT mode is set, then there is a short packet detected. * We need not give a short packet on IN, as it is the HAL which has * initiated a short packet transfer */ if (((data32 & NET2280_EP_STAT_NAKOUT) != 0) && (direction == USB_TCD_ENDPT_OUT)) { pTrb->uEndptInterruptStatus |= USBTCD_ENDPOINT_DATA_UNDERRUN;#ifdef NET2280_DMA_SUPPORTED /* Set the flag indicating that a short packet is detected */ pEndpointInfo->shortPacket = TRUE; #endif } /* * read the EP_RSP register and determine whether the corresponding * endpoint is stalled or not */ if ((NET2280_CFG_READ (pTarget, NET2280_EP_RSP_OFFSET (endpointIndex)) & NET2280_EP_RSP_STALL) != 0) { /* endpoints are stalled */ pTrb->uEndptInterruptStatus |= USBTCD_ENDPOINT_STALL_ERROR; } } USB_NET2280_DEBUG ("usbTcdNET2280FncEndpointIntStatusGet: Exiting...\n", 0,0,0,0,0,0); return OK; }/********************************************************************************* usbTcdNET2280FncEndpointIntStatusClear - 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 usbTcdNET2280FncEndpointIntStatusClear ( pTRB_ENDPOINT_INTERRUPT_STATUS_CLEAR pTrb /* Trb to be executed */ ) { pTRB_HEADER pHeader = (pTRB_HEADER) pTrb; /* TRB_HEADER */ pUSB_TCD_NET2280_TARGET pTarget = NULL; /* USB_TCD_NET2280_TARGET */ pUSB_TCD_NET2280_ENDPOINT pEndpoint = NULL;/*USB_TCD_NET2280_ENDPOINT*/ UINT8 endpointIndex = 0; /* endpoint index */ UINT8 direction = 0; /* direction */ /* WindView Instrumentation */ USB_TCD_LOG_EVENT(USB_TCD_NET2280_INTERRUPT, "usbTcdNET2280FncEndpointIntStatusClear entered...", USB_TCD_NET2280_WV_FILTER); USB_NET2280_DEBUG ("usbTcdNET2280FncEndpointIntStatusClear: 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_NET2280_INTERRUPT, "usbTcdNET2280FncEndpointIntStatusClear exiting:Bad Parameter Received", USB_TCD_NET2280_WV_FILTER); USB_NET2280_ERROR ("usbTcdNET2280FncEndpointIntStatusClear: \ Bad Parameters...\n",0,0,0,0,0,0); return ossStatus (S_usbTcdLib_BAD_PARAM); } pTarget = (pUSB_TCD_NET2280_TARGET) pHeader->handle; pEndpoint = (pUSB_TCD_NET2280_ENDPOINT)pTrb->pipeHandle; /* Determine the endpoint index and direction */ endpointIndex = pEndpoint->endpointIndex; direction = pEndpoint->direction; /* If setup interrupt is pending, clear the member in pTarget structure */ if ((endpointIndex == NET2280_ENDPT_0_OUT) && (pTarget->setupIntPending)) { /* To temporarily store the register contents */ UINT32 dataTemp = 0; /* Set setupIntPending to FALSE */ pTarget->setupIntPending = FALSE; /* * Disable the setup interrupt, till we handle the setup. This will * be enabled in the endpoint interrupt status clear. */ dataTemp = NET2280_CFG_READ(pTarget,NET2280_PCIIRQENB0_REG); dataTemp |= NET2280_IRQENB0_SETUP; NET2280_CFG_WRITE(pTarget,NET2280_PCIIRQENB0_REG, dataTemp); /* * If there is an OUT interrupt pending on endpoint 0, * enable the interrupts */ if ((pTarget->endptIntPending & (1 << NET2280_ENDPT_0_OUT)) != 0) { dataTemp = NET2280_CFG_READ (pTarget, NET2280_EP_IRQENB_OFFSET(NET2280_ENDPT_0_OUT)); dataTemp |= NET2280_EP_STAT_DPR; NET2280_CFG_WRITE(pTarget, NET2280_EP_IRQENB_OFFSET(NET2280_ENDPT_0_OUT), dataTemp); } } /* Check if direction is IN and DMA interrupt is pending on that endpoint */ else {#ifdef NET2280_DMA_SUPPORTED switch (endpointIndex) { case NET2280_ENDPT_0_OUT: case NET2280_ENDPT_0_IN: case NET2280_ENDPT_E: case NET2280_ENDPT_F: /* dma transfers cannot happen on these endpoints */ break; default : if ((direction == USB_ENDPOINT_IN) && ((pTarget->dmaEot & (1 << endpointIndex)) != 0)) disableDma (pTarget, pEndpoint); }#endif } USB_NET2280_DEBUG ("usbTcdNET2280FncEndpointIntStatusClear: Exiting...\n", 0,0,0,0,0,0); return OK; }/******************************************************************************** usbTcdNET2280FncHandleResetInterrupt - implements TCD_FNC_HANDLE_RESET_INTERRUPT** This fucntion is called whenever reset interrupt has occured. It determine* the operating speed of the device.** RETURNS: OK or ERROR if any.** ERRNO:* \is* \i S_usbTcdLib_BAD_PARAM* Bad paramter is passed.* \ie** \NOMANUAL*/LOCAL STATUS usbTcdNET2280FncHandleResetInterrupt ( pTRB_HANDLE_RESET_INTERRUPT pTrb /* TRB to be executed */ ) { pTRB_HEADER pHeader = (pTRB_HEADER) pTrb; /* TRB_HEADER */ pUSB_TCD_NET2280_TARGET pTarget = NULL; /* USB_TCD_NET2280_TARGET */ UINT32 data32 = 0; /* WindView Instrumentation */ USB_TCD_LOG_EVENT(USB_TCD_NET2280_INTERRUPT, "usbTcdNET2280FncHandleResetInterrupt entered.",USB_TCD_NET2280_WV_FILTER); USB_NET2280_DEBUG ("usbTcdNET2280FncHandleResetInterrupt: 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, "usbTcdNET2280FncHandleResetInterrupt exiting:Bad Parameter Received.", USB_TCD_NET2280_WV_FILTER); USB_NET2280_DEBUG ("usbTcdNET2280FncHandleResetInterrupt : \ Bad Parameters...\n",0,0,0,0,0,0); return ossStatus (S_usbTcdLib_BAD_PARAM); } pTarget = (pUSB_TCD_NET2280_TARGET) pHeader->handle; OSS_THREAD_SLEEP(1); /* read the USB STATUS register and determine the speed */ data32 = NET2280_CFG_READ (pTarget, NET2280_USBSTAT_REG); if ((data32 & NET2280_USBSTAT_FS) != 0) { /* Device is operating in Full Speed, update pTrb :: speed */ pTrb->uSpeed = USB_TCD_FULL_SPEED; pTarget->speed = USB_TCD_FULL_SPEED; } else if ((data32 & NET2280_USBSTAT_HS) != 0) { /* Device is operating in High Speed, update pTrb :: speed */ pTrb->uSpeed = USB_TCD_HIGH_SPEED; pTarget->speed = USB_TCD_HIGH_SPEED; } else return ERROR; USB_NET2280_DEBUG ("usbTcdNET2280FncHandleResetInterrupt: Exiting...\n", 0,0,0,0,0,0); return OK; }/******************************************************************************** usbTcdNET2280FncHandleDisconnectInterrupt - implements TCD_FNC_HANDLE_DISCONNECT_INTERRUPT** This fucntion is called whenever disconnect interrupt has occured. It flushes* the FIFO buffer.** RETURNS: OK or ERROR if any.** ERRNO:* \is* \i S_usbTcdLib_BAD_PARAM* Bad paramter is passed.* \ie** \NOMANUAL*/LOCAL STATUS usbTcdNET2280FncHandleDisconnectInterrupt ( pTRB_HANDLE_DISCONNECT_INTERRUPT pTrb ) { pTRB_HEADER pHeader = (pTRB_HEADER) pTrb; /* TRB_HEADER */ pUSB_TCD_NET2280_TARGET pTarget = NULL; /* USB_TCD_NET2280_TARGET */ UINT32 data32 = 0; /* WindView Instrumentation */ USB_TCD_LOG_EVENT(USB_TCD_NET2280_INTERRUPT, "usbTcdNET2280FncHandleDisconnectInterrupt entered...", USB_TCD_NET2280_WV_FILTER); USB_NET2280_DEBUG ("usbTcdNET2280FncHandleDisconnectInterrupt: 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, "usbTcdNET2280FncHandleDisconnectInterrupt exiting: Bad Parameter \ Received...", USB_TCD_NET2280_WV_FILTER); USB_NET2280_DEBUG ("usbTcdNET2280FncHandleDisconnectInterrupt : \ Bad Parameters...\n",0,0,0,0,0,0); return ossStatus (S_usbTcdLib_BAD_PARAM); } pTarget = (pUSB_TCD_NET2280_TARGET) pHeader->handle; /* read the DEVINIT regsiter */ data32 = NET2280_CFG_READ (pTarget, NET2280_DEVINIT_REG); /* Set bit 4 of DEVINIT register to flush the FIFO */ data32 |= NET2280_DEVINIT_FIFO_RESET |NET2280_DEVINIT_USB_RESET ; NET2280_CFG_WRITE (pTarget, NET2280_DEVINIT_REG, data32); /* Reset the USB CTL register */ NET2280_CFG_WRITE (pTarget, NET2280_USBCTL_REG, 0); /* Set the USB Detect Enable bit if USB CTL register to 1 */ NET2280_CFG_WRITE (pTarget, NET2280_USBCTL_REG, NET2280_USBCTL_REG_USBDE); USB_NET2280_DEBUG ("usbTcdNET2280FncHandleDisconnectInterrupt: Exiting.\n", 0,0,0,0,0,0); return OK; }
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -