From a73017fdc23f7bedf38e754cba3a4ffbcf8d4c27 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 5 Dec 2018 13:20:25 +0700 Subject: hal clean up - replace tusb_hal_int_enable/disable to dcd_int_enable/disable, hcd_int_enable/disable - remove tusb_hal_init(), this will be part of dcd_init/hcd_init, anything beyond dcd/hcd should be inited by bsp --- src/device/usbd.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/device') diff --git a/src/device/usbd.c b/src/device/usbd.c index 81fcfe959..ddb63cebb 100644 --- a/src/device/usbd.c +++ b/src/device/usbd.c @@ -190,23 +190,26 @@ bool tud_mounted(void) //--------------------------------------------------------------------+ tusb_error_t usbd_init (void) { + // Init device queue & task + _usbd_q = osal_queue_create(&_usbd_qdef); + TU_VERIFY(_usbd_q, TUSB_ERROR_OSAL_QUEUE_FAILED); + + osal_task_create(&_usbd_task_def); + + // Init class drivers + for (uint8_t i = 0; i < USBD_CLASS_DRIVER_COUNT; i++) usbd_class_drivers[i].init(); + + // Init device controller driver #if (CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE) dcd_init(0); + dcd_int_enable(0); #endif #if (CFG_TUSB_RHPORT1_MODE & OPT_MODE_DEVICE) dcd_init(1); + dcd_int_enable(1); #endif - //------------- Task init -------------// - _usbd_q = osal_queue_create(&_usbd_qdef); - TU_VERIFY(_usbd_q, TUSB_ERROR_OSAL_QUEUE_FAILED); - - osal_task_create(&_usbd_task_def); - - //------------- class init -------------// - for (uint8_t i = 0; i < USBD_CLASS_DRIVER_COUNT; i++) usbd_class_drivers[i].init(); - return TUSB_ERROR_NONE; } -- cgit v1.3.1