tinyusb/src/host/ehci/ehci.c
void hal_hcd_isr(uint8_t hostid)
{
  ehci_registers_t* const regs = get_operational_register(hostid);

  uint32_t int_status = regs->usb_sts;
  int_status &= regs->usb_int_enable;
  
  regs->usb_sts |= int_status; // Acknowledge handled interrupt

  if (int_status == 0) return;

  if (int_status & EHCI_INT_MASK_PORT_CHANGE)
  {
    uint32_t port_status = regs->portsc & EHCI_PORTSC_MASK_ALL;

    if (regs->portsc_bit.connect_status_change)
    {
      port_connect_status_change_isr(hostid);
    }

    regs->portsc |= port_status; // Acknowledge change bits in portsc
  }

  if (int_status & EHCI_INT_MASK_ERROR)
  {
    xfer_error_isr(hostid);
  }

  //------------- some QTD/SITD/ITD with IOC set is completed -------------//
  if (int_status & EHCI_INT_MASK_NXP_ASYNC)
  {
    async_list_xfer_complete_isr( get_async_head(hostid) );
  }

#if EHCI_PERIODIC_LIST // TODO refractor/group this together
  if (int_status & EHCI_INT_MASK_NXP_PERIODIC)
  {
    for (uint8_t i=1; i <= EHCI_FRAMELIST_SIZE; i *= 2)
    {
      period_list_xfer_complete_isr( hostid, i );
    }
  }
#endif

  //------------- There is some removed async previously -------------//
  if (int_status & EHCI_INT_MASK_ASYNC_ADVANCE) // need to place after EHCI_INT_MASK_NXP_ASYNC
  {
    async_advance_isr( get_async_head(hostid) );
  }
}
//------------- Host Controller Driver's Interrupt Handler -------------//

Host Controller Driver's Interrupt Handler
Host Controller Driver ' s Interrupt Handler
void hal_hcd_isr(uint8_t hostid)
{
  ehci_registers_t* const regs = get_operational_register(hostid);
  uint32_t int_status = regs->usb_sts;
  int_status &= regs->usb_int_enable;
  regs->usb_sts |= int_status; 
  if (int_status == 0) return;
  if (int_status & EHCI_INT_MASK_PORT_CHANGE)
  {
    uint32_t port_status = regs->portsc & EHCI_PORTSC_MASK_ALL;
    if (regs->portsc_bit.connect_status_change)
    {
      port_connect_status_change_isr(hostid);
    }
    regs->portsc |= port_status; 
  }
  if (int_status & EHCI_INT_MASK_ERROR)
  {
    xfer_error_isr(hostid);
  }
  if (int_status & EHCI_INT_MASK_NXP_ASYNC)
  {
    async_list_xfer_complete_isr( get_async_head(hostid) );
  }
#if EHCI_PERIODIC_LIST 
  if (int_status & EHCI_INT_MASK_NXP_PERIODIC)
  {
    for (uint8_t i=1; i <= EHCI_FRAMELIST_SIZE; i *= 2)
    {
      period_list_xfer_complete_isr( hostid, i );
    }
  }
#endif
  if (int_status & EHCI_INT_MASK_ASYNC_ADVANCE) 
  {
    async_advance_isr( get_async_head(hostid) );
  }
}
void hal_hcd_isr ( uint8_t hostid ) { ehci_registers_t * const regs = get_operational_register ( hostid ) ; uint32_t int_status = regs -> usb_sts ; int_status &= regs -> usb_int_enable ; regs -> usb_sts |= int_status ; if ( int_status == 0 ) return ; if ( int_status & EHCI_INT_MASK_PORT_CHANGE ) { uint32_t port_status = regs -> portsc & EHCI_PORTSC_MASK_ALL ; if ( regs -> portsc_bit . connect_status_change ) { port_connect_status_change_isr ( hostid ) ; } regs -> portsc |= port_status ; } if ( int_status & EHCI_INT_MASK_ERROR ) { xfer_error_isr ( hostid ) ; } if ( int_status & EHCI_INT_MASK_NXP_ASYNC ) { async_list_xfer_complete_isr ( get_async_head ( hostid ) ) ; } #if EHCI_PERIODIC_LIST if ( int_status & EHCI_INT_MASK_NXP_PERIODIC ) { for ( uint8_t i = 1 ; i <= EHCI_FRAMELIST_SIZE ; i *= 2 ) { period_list_xfer_complete_isr ( hostid , i ) ; } } #endif if ( int_status & EHCI_INT_MASK_ASYNC_ADVANCE ) { async_advance_isr ( get_async_head ( hostid ) ) ; } }
Host Controller Driver's Interrupt Handler
Host Controller Driver ' s Interrupt Handler
// Acknowledge handled interrupt
 // Acknowledge change bits in portsc
 //------------- some QTD/SITD/ITD with IOC set is completed -------------//
 // TODO refractor/group this together
 //------------- There is some removed async previously -------------//
 // need to place after EHCI_INT_MASK_NXP_ASYNC
