// This function handles all USB Host Interrupts void USBH_OTG_ISR_Handler (USB_OTG_CORE_HANDLE *pdev) { USB_OTG_GINTSTS_TypeDef gintsts; /* Check if HOST Mode : removed , always the case */ gintsts.d32 = USB_OTG_ReadCoreItr(pdev); if (!gintsts.d32) { return ; } if (gintsts.b.sofintr) { USB_OTG_USBH_handle_sof_ISR (pdev); } if (gintsts.b.rxstsqlvl) { USB_OTG_USBH_handle_rx_qlvl_ISR (pdev); } if (gintsts.b.nptxfempty) { USB_OTG_USBH_handle_nptxfempty_ISR (pdev); } if (gintsts.b.ptxfempty) { USB_OTG_USBH_handle_ptxfempty_ISR (pdev); } if (gintsts.b.hcintr) { USB_OTG_USBH_handle_hc_ISR (pdev); } if (gintsts.b.portintr) { USB_OTG_USBH_handle_port_ISR (pdev); } if (gintsts.b.disconnect) { USB_OTG_USBH_handle_Disconnect_ISR (pdev); } if (gintsts.b.incomplisoout) { USB_OTG_USBH_handle_IncompletePeriodicXfer_ISR (pdev); } }
/** * @brief STM32_USBF_OTG_ISR_Handler * handles all USB Interrupts * @param pdev: device instance * @retval status */ uint32_t USBD_OTG_ISR_Handler (USB_OTG_CORE_HANDLE *pdev) { USB_OTG_GINTSTS_TypeDef gintr_status; uint32_t retval = 0; if (USB_OTG_IsDeviceMode(pdev)) /* ensure that we are in device mode */ { gintr_status.d32 = USB_OTG_ReadCoreItr(pdev); if (!gintr_status.d32) /* avoid spurious interrupt */ { return 0; } if (gintr_status.b.outepintr) { retval |= DCD_HandleOutEP_ISR(pdev); } if (gintr_status.b.inepint) { retval |= DCD_HandleInEP_ISR(pdev); } if (gintr_status.b.modemismatch) { USB_OTG_GINTSTS_TypeDef gintsts; /* Clear interrupt */ gintsts.d32 = 0; gintsts.b.modemismatch = 1; USB_OTG_WRITE_REG32(&pdev->regs.GREGS->GINTSTS, gintsts.d32); } if (gintr_status.b.wkupintr) { retval |= DCD_HandleResume_ISR(pdev); } if (gintr_status.b.usbsuspend) { retval |= DCD_HandleUSBSuspend_ISR(pdev); } if (gintr_status.b.sofintr) { retval |= DCD_HandleSof_ISR(pdev); } if (gintr_status.b.rxstsqlvl) { retval |= DCD_HandleRxStatusQueueLevel_ISR(pdev); } if (gintr_status.b.usbreset) { retval |= DCD_HandleUsbReset_ISR(pdev); } if (gintr_status.b.enumdone) { retval |= DCD_HandleEnumDone_ISR(pdev); } if (gintr_status.b.incomplisoin) { retval |= DCD_IsoINIncomplete_ISR(pdev); } if (gintr_status.b.incomplisoout) { retval |= DCD_IsoOUTIncomplete_ISR(pdev); } #ifdef VBUS_SENSING_ENABLED if (gintr_status.b.sessreqintr) { retval |= DCD_SessionRequest_ISR(pdev); } if (gintr_status.b.otgintr) { retval |= DCD_OTG_ISR(pdev); } #endif } return retval; }
//-------------------------------------------------------------- uint32_t USBH_OTG_ISR_Handler (USB_OTG_CORE_HANDLE *pdev) { USB_OTG_GINTSTS_TypeDef gintsts; uint32_t retval = 0; gintsts.d32 = 0; /* Check if HOST Mode */ if (USB_OTG_IsHostMode(pdev)) { gintsts.d32 = USB_OTG_ReadCoreItr(pdev); if (!gintsts.d32) { return 0; } if (gintsts.b.sofintr) { retval |= USB_OTG_USBH_handle_sof_ISR (pdev); } if (gintsts.b.rxstsqlvl) { retval |= USB_OTG_USBH_handle_rx_qlvl_ISR (pdev); } if (gintsts.b.nptxfempty) { retval |= USB_OTG_USBH_handle_nptxfempty_ISR (pdev); } if (gintsts.b.ptxfempty) { retval |= USB_OTG_USBH_handle_ptxfempty_ISR (pdev); } if (gintsts.b.hcintr) { retval |= USB_OTG_USBH_handle_hc_ISR (pdev); } if (gintsts.b.portintr) { retval |= USB_OTG_USBH_handle_port_ISR (pdev); } if (gintsts.b.disconnect) { retval |= USB_OTG_USBH_handle_Disconnect_ISR (pdev); } if (gintsts.b.incomplisoout) { retval |= USB_OTG_USBH_handle_IncompletePeriodicXfer_ISR (pdev); } } return retval; }