コード例 #1
0
void DFU_UsbStop (void)
{
  Disable_global_interrupt();
  Usb_disable();
  (void)Is_usb_enabled();
  Enable_global_interrupt();
}
コード例 #2
0
ファイル: usb_host_task.c プロジェクト: AndreyMostovov/asf
//!
//! @brief This function initializes the USB host controller.
//!
//! This function enables the USB controller for host-mode operation.
//!
void usb_host_task_init(void)
{
  //! @todo Implement this on the silicon version
  //Pll_start_auto();
  //Wait_pll_ready();
  cpu_irq_disable();
  Usb_disable();
  (void)Is_usb_enabled();
  cpu_irq_enable();
  Usb_disable_otg_pad();
  Usb_enable_otg_pad();
  Usb_enable();
  Usb_unfreeze_clock();
  (void)Is_usb_clock_frozen();
#if USB_VBOF_ACTIVE_LEVEL == HIGH
  Usb_set_vbof_active_high();
#else // USB_VBOF_ACTIVE_LEVEL == LOW
  Usb_set_vbof_active_low();
#endif
  Usb_output_vbof_pin();
  Usb_disable_vbus_hw_control();  // Force VBus generation without time-out
  Host_enable_device_disconnection_interrupt();
  Host_enable_device_connection_interrupt();
#if USB_HOST_PIPE_INTERRUPT_TRANSFER == ENABLE
  reset_it_pipe_str();
#endif
  device_state = DEVICE_UNATTACHED;
  Host_clear_device_status();
  Host_ack_request_resume();
  sof_cnt = 0;

#ifdef FREERTOS_USED
  xTaskCreate(usb_host_task,
              configTSK_USB_HST_NAME,
              configTSK_USB_HST_STACK_SIZE,
              NULL,
              configTSK_USB_HST_PRIORITY,
              &usb_host_tsk);
#endif  // FREERTOS_USED
}