src/device/usbd.c
// Helper to parse an pair of endpoint descriptors (IN & OUT)

Helper to parse an pair of endpoint descriptors (IN & OUT)
Helper to parse an pair of endpoint descriptors ( IN & OUT )
bool usbd_open_edpt_pair(uint8_t rhport, tusb_desc_endpoint_t const* ep_desc, uint8_t xfer_type, uint8_t* ep_out, uint8_t* ep_in)
{
  for(int i=0; i<2; i++)
  {
    TU_ASSERT(TUSB_DESC_ENDPOINT == ep_desc->bDescriptorType &&
              xfer_type          == ep_desc->bmAttributes.xfer );
    TU_ASSERT(dcd_edpt_open(rhport, ep_desc));
    if ( tu_edpt_dir(ep_desc->bEndpointAddress) == TUSB_DIR_IN )
    {
      (*ep_in) = ep_desc->bEndpointAddress;
    }else
    {
      (*ep_out) = ep_desc->bEndpointAddress;
    }
    ep_desc = (tusb_desc_endpoint_t const *) tu_desc_next(ep_desc);
  }
  return true;
}
bool usbd_open_edpt_pair ( uint8_t rhport , tusb_desc_endpoint_t const * ep_desc , uint8_t xfer_type , uint8_t * ep_out , uint8_t * ep_in ) { for ( int i = 0 ; i < 2 ; i ++ ) { TU_ASSERT ( TUSB_DESC_ENDPOINT == ep_desc -> bDescriptorType && xfer_type == ep_desc -> bmAttributes . xfer ) ; TU_ASSERT ( dcd_edpt_open ( rhport , ep_desc ) ) ; if ( tu_edpt_dir ( ep_desc -> bEndpointAddress ) == TUSB_DIR_IN ) { ( * ep_in ) = ep_desc -> bEndpointAddress ; } else { ( * ep_out ) = ep_desc -> bEndpointAddress ; } ep_desc = ( tusb_desc_endpoint_t const * ) tu_desc_next ( ep_desc ) ; } return true ; }
Helper to parse an pair of endpoint descriptors (IN & OUT)
Helper to parse an pair of endpoint descriptors ( IN & OUT )