tinyusb/src/host/usbh.c
bool usbh_init(void)
{
  tu_memclr(_usbh_devices, sizeof(usbh_device_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));

  //------------- Enumeration & Reporter Task init -------------//
  _usbh_q = osal_queue_create( &_usbh_qdef );
  TU_ASSERT(_usbh_q != NULL);

  osal_task_create(&_usbh_task_def);

  //------------- Semaphore, Mutex for Control Pipe -------------//
  for(uint8_t i=0; i<CFG_TUSB_HOST_DEVICE_MAX+1; i++) // including address zero
  {
    usbh_device_t * const p_device = &_usbh_devices[i];

    p_device->control.sem_hdl = osal_semaphore_create(&p_device->control.sem_def);
    TU_ASSERT(p_device->control.sem_hdl != NULL);

    p_device->control.mutex_hdl = osal_mutex_create(&p_device->control.mutex_def);
    TU_ASSERT(p_device->control.mutex_hdl != NULL);
  }

  //------------- class init -------------//
  for (uint8_t class_index = 1; class_index < USBH_CLASS_DRIVER_COUNT; class_index++)
  {
    if (usbh_class_drivers[class_index].init)
    {
      usbh_class_drivers[class_index].init();
    }
  }

  TU_ASSERT(hcd_init());
  hcd_int_enable(TUH_OPT_RHPORT);

  return true;
}
//--------------------------------------------------------------------+
// CLASS-USBD API (don't require to verify parameters)
//--------------------------------------------------------------------+

CLASS-USBD API (don't require to verify parameters)
CLASS - USBD API ( don ' t require to verify parameters )
bool usbh_init(void)
{
  tu_memclr(_usbh_devices, sizeof(usbh_device_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
  _usbh_q = osal_queue_create( &_usbh_qdef );
  TU_ASSERT(_usbh_q != NULL);
  osal_task_create(&_usbh_task_def);
  for(uint8_t i=0; i<CFG_TUSB_HOST_DEVICE_MAX+1; i++) 
  {
    usbh_device_t * const p_device = &_usbh_devices[i];
    p_device->control.sem_hdl = osal_semaphore_create(&p_device->control.sem_def);
    TU_ASSERT(p_device->control.sem_hdl != NULL);
    p_device->control.mutex_hdl = osal_mutex_create(&p_device->control.mutex_def);
    TU_ASSERT(p_device->control.mutex_hdl != NULL);
  }
  for (uint8_t class_index = 1; class_index < USBH_CLASS_DRIVER_COUNT; class_index++)
  {
    if (usbh_class_drivers[class_index].init)
    {
      usbh_class_drivers[class_index].init();
    }
  }
  TU_ASSERT(hcd_init());
  hcd_int_enable(TUH_OPT_RHPORT);
  return true;
}
bool usbh_init ( void ) { tu_memclr ( _usbh_devices , sizeof ( usbh_device_t ) * ( CFG_TUSB_HOST_DEVICE_MAX + 1 ) ) ; _usbh_q = osal_queue_create ( & _usbh_qdef ) ; TU_ASSERT ( _usbh_q != NULL ) ; osal_task_create ( & _usbh_task_def ) ; for ( uint8_t i = 0 ; i < CFG_TUSB_HOST_DEVICE_MAX + 1 ; i ++ ) { usbh_device_t * const p_device = & _usbh_devices [ i ] ; p_device -> control . sem_hdl = osal_semaphore_create ( & p_device -> control . sem_def ) ; TU_ASSERT ( p_device -> control . sem_hdl != NULL ) ; p_device -> control . mutex_hdl = osal_mutex_create ( & p_device -> control . mutex_def ) ; TU_ASSERT ( p_device -> control . mutex_hdl != NULL ) ; } for ( uint8_t class_index = 1 ; class_index < USBH_CLASS_DRIVER_COUNT ; class_index ++ ) { if ( usbh_class_drivers [ class_index ] . init ) { usbh_class_drivers [ class_index ] . init ( ) ; } } TU_ASSERT ( hcd_init ( ) ) ; hcd_int_enable ( TUH_OPT_RHPORT ) ; return true ; }
+
CLASS-USBD API (don't require to verify parameters)
+
+ CLASS - USBD API ( don ' t require to verify parameters ) +
//------------- Enumeration & Reporter Task init -------------//
 //------------- Semaphore, Mutex for Control Pipe -------------//
 // including address zero
 //------------- class init -------------//
