📄 usbtcdisp1582interrupt.c
字号:
UINT8 direction = 0; /* direction */ /* WindView Instrumentation */ USB_TCD_LOG_EVENT(USB_TCD_ISP1582_INTERRUPT, "usbTcdIsp1582FncEndpointIntStatusClear entered...", USB_TCD_ISP582_WV_FILTER); USBISP1582_DEBUG ("usbTcdIsp1582FncEndpointIntStatusClear: 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, "usbTcdIsp1582FncEndpointIntStatusClear exiting: Bad Parameter Received...", USB_TCD_ISP582_WV_FILTER); USBISP1582_ERROR ("usbTcdIsp1582FncEndpointIntStatusClear : \ 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 ((endpointIndex == ISP1582_ENDPT_0_RX) && (pTarget->setupIntPending)) { /* Setup Interrupt is pending. Update setupIntPending */ pTarget->setupIntPending = FALSE; } /* Check whether there is a DMA Eot for the current endpoint */ if ((pTarget->dmaEndpointId == endpointIndex) && (pTarget->dmaEot) && (pTarget->dmaInUse)) { /* If the transfer type is IN, disable the DMA controller */ if (direction == USB_ENDPOINT_IN) { UINT32 data32 = 0; UINT8 i = 0; /* Reset the DMA Interrupt Enable Register */ isp1582Write16 (pTarget , ISP1582_DMA_INT_ENBL_REG , 0); /* Read the interrupt enable register */ data32 = isp1582Read32 (pTarget , ISP_1582_INT_ENABLE_REG); /* * Enable that endpoint by writing into interrupt enable * register */ data32 |= ISP1582_INT_ENABLE_REG_ENDPT_SET(endpointIndex); isp1582Write32 (pTarget , ISP_1582_INT_ENABLE_REG ,data32); /* Initialize the DMA Endpoint Register to endpoint not used. */ isp1582Write8 (pTarget , ISP1582_DMA_ENDPT_REG , pTarget->dmaEndptNotInUse); /* Set dmaEot & dmaInUse to False */ pTarget->dmaEot = FALSE; pTarget->dmaInUse = FALSE; /* Set dmaEndpointId of USB_TCD-ISP1582_TARGET structure */ pTarget->dmaEndpointId = i; /* Clear the dma interrupt reason register */ isp1582Write16 (pTarget , ISP1582_DMA_INT_RESN_REG , ISP1582_DMA_INT_RESN_MASK); } } if ((endpointIndex == ISP1582_ENDPT_0_RX) && pTarget->controlINStatusPending) { UINT8 data = 0; /* Select IN endpoint for initiating a status stage */ isp1582Write8 (pTarget , ISP1582_ENDPT_INDEX_REG , ISP1582_ENDPT_0_TX); /* Initiate the status stage */ data = isp1582Read8 (pTarget , ISP1582_CNTL_FUNC_REG); isp1582Write8 (pTarget , ISP1582_CNTL_FUNC_REG , data | ISP1582_CNTL_FUNC_REG_STATUS); pTarget->controlINStatusPending = FALSE; } /* WindView Instrumentation */ USB_TCD_LOG_EVENT(USB_TCD_ISP1582_INTERRUPT, "usbTcdIsp1582FncEndpointIntStatusClear exiting...", USB_TCD_ISP582_WV_FILTER); USBISP1582_DEBUG ("usbTcdIsp1582FncEndpointIntStatusClear: Exiting...\n", 0,0,0,0,0,0); return OK; }/********************************************************************************* usbTcdIsp1582FncHandleResumeInterrupt - implements TCD_FNC_HANDLE_RESUME_INTERRUPT** This fucntion is called whenever resume interrupt has occured.** RETURNS: OK or ERROR if any.** ERRNO:* \is* \i S_usbTcdLib_BAD_PARAM* Bad paramter is passed.* \ie** \NOMANUAL*/LOCAL STATUS usbTcdIsp1582FncHandleResumeInterrupt ( pTRB_HANDLE_RESUME_INTERRUPT pTrb /* Trb to be executed */ ) { pTRB_HEADER pHeader = (pTRB_HEADER) pTrb; /* TRB_HEADER */ pUSB_TCD_ISP1582_TARGET pTarget = NULL; /* USB_TCD_ISP1582_TARGET */ /* WindView Instrumentation */ USB_TCD_LOG_EVENT(USB_TCD_ISP1582_INTERRUPT, "usbTcdIsp1582FncHandleResumeInterrupt entered...", USB_TCD_ISP582_WV_FILTER); USBISP1582_DEBUG ("usbTcdIsp1582FncHandleResumeInterrupt: 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, "usbTcdIsp1582FncHandleResumeInterrupt exiting: Bad Parameter Received...", USB_TCD_ISP582_WV_FILTER); USBISP1582_ERROR ("usbTcdIsp1582FncHandleResumeInterrupt : \ Bad Parameters...\n",0,0,0,0,0,0); return ossStatus (S_usbTcdLib_BAD_PARAM); } pTarget = (pUSB_TCD_ISP1582_TARGET) pHeader->handle; /* Unlock the device address by writing code 0xAA37 */ isp1582Write16 (pTarget,ISP1582_UNLOCK_DEV_REG,ISP1582_UNLOCK_DEV_REG_CODE); /* WindView Instrumentation */ USB_TCD_LOG_EVENT(USB_TCD_ISP1582_INTERRUPT, "usbTcdIsp1582FncHandleResumeInterrupt exiting...", USB_TCD_ISP582_WV_FILTER); USBISP1582_DEBUG ("usbTcdIsp1582FncHandleResumeInterrupt: Exiting...\n", 0,0,0,0,0,0); return OK; }/******************************************************************************** usbTcdIsp1582FncHandleResetInterrupt - implements TCD_FNC_HANDLE_RESET_INTERRUPT** This fucntion is called whenever reset interrupt has occured.** RETURNS: OK or ERROR if any.** ERRNO:* \is* \i S_usbTcdLib_BAD_PARAM* Bad paramter is passed.* \ie** \NOMANUAL*/LOCAL STATUS usbTcdIsp1582FncHandleResetInterrupt ( pTRB_HANDLE_RESET_INTERRUPT 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, "usbTcdIsp1582FncHandleResetInterrupt entered...", USB_TCD_ISP582_WV_FILTER); USBISP1582_DEBUG ("usbTcdIsp1582FncHandleResetInterrupt: 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, "usbTcdIsp1582FncHandleResetInterrupt exiting: Bad Parameter Received...", USB_TCD_ISP582_WV_FILTER); USBISP1582_ERROR ("usbTcdIsp1582FncHandleResetInterrupt : \ Bad Parameters...\n",0,0,0,0,0,0); return ossStatus (S_usbTcdLib_BAD_PARAM); } pTarget = (pUSB_TCD_ISP1582_TARGET) pHeader->handle; /* Read the interrupt enable register */ data32 = isp1582Read32(pTarget , ISP_1582_INT_ENABLE_REG); /* Enable the setup interrupt */ data32 |= ISP1582_INT_ENABLE_REG_IEP0SETUP; /* Set appropiate bit of Interrupt Enable Register */ isp1582Write32 (pTarget , ISP_1582_INT_ENABLE_REG , data32); /* Delay for High Speed Status Set */ OSS_THREAD_SLEEP (1); /* * Read the interrupt status register. If bit HS_STAT is set, device * is operating at High Speed. */ if ((isp1582Read32 (pTarget , ISP1582_INT_REG) & ISP1582_INT_REG_HS_STA) != 0) { pTrb->uSpeed = USB_TCD_HIGH_SPEED; /* WindView Instrumentation */ USB_TCD_LOG_EVENT(USB_TCD_ISP1582_INTERRUPT, "usbTcdIsp1582FncHandleResetInterrupt: High Speed Detected...", USB_TCD_ISP582_WV_FILTER); /* Clear the High Speed Status Change */ isp1582Write32 (pTarget , ISP1582_INT_REG , ISP1582_INT_REG_HS_STA); } else { pTrb->uSpeed = USB_TCD_FULL_SPEED; /* WindView Instrumentation */ USB_TCD_LOG_EVENT(USB_TCD_ISP1582_INTERRUPT, "usbTcdIsp1582FncHandleResetInterrupt: Full Speed Detected...", USB_TCD_ISP582_WV_FILTER); } /* WindView Instrumentation */ USB_TCD_LOG_EVENT(USB_TCD_ISP1582_INTERRUPT, "usbTcdIsp1582FncHandleResetInterrupt exiting...", USB_TCD_ISP582_WV_FILTER); return OK; }#ifdef ISP1582_POLLING/******************************************************************************** usbTcdIsp1582PollingIsr - polling ISR of ISP 1582 TCD** This is the ISR for the ISP 1582 TCD which runs in polling mode** RETURNS: N/A** ERRNO:* none** \NOMANUAL*/LOCAL VOID usbTcdIsp1582PollingIsr ( pVOID param /* polling isr paramter */ ) { pUSB_TCD_ISP1582_TARGET pTarget = NULL; /* USB_TCD_ISP1582_TARGET */ pTarget = (pUSB_TCD_ISP1582_TARGET)param; while(1) { if ((isp1582Read32 (pTarget , ISP1582_INT_REG) & (isp1582Read32 (pTarget , ISP_1582_INT_ENABLE_REG)))!= 0) usbTcdIsp1582Isr(param); OSS_THREAD_SLEEP (1); } return; }#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -