From 381caaff1c90c2e73ccd30edd64473d02bb09604 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 2 Mar 2018 21:41:38 +0700 Subject: [PATCH] rename hal_init() to hal_usb_init() --- hw/mcu/nxp/lpc11uxx/hal_mcu/hal_lpc11uxx.c | 2 +- hw/mcu/nxp/lpc13uxx/hal_mcu/hal_lpc13uxx.c | 2 +- hw/mcu/nxp/lpc175x_6x/hal_mcu/hal_lpc175x_6x.c | 2 +- {tinyusb/device => hw/mcu/nxp/lpc43xx/hal_mcu}/dcd_lpc43xx.c | 0 {tinyusb/device => hw/mcu/nxp/lpc43xx/hal_mcu}/dcd_lpc43xx.h | 0 hw/mcu/nxp/lpc43xx/hal_mcu/hal_lpc43xx.c | 2 +- tinyusb/device/usbd_dcd.h | 2 ++ tinyusb/tusb.c | 2 +- tinyusb/tusb_hal.h | 2 +- 9 files changed, 8 insertions(+), 6 deletions(-) rename {tinyusb/device => hw/mcu/nxp/lpc43xx/hal_mcu}/dcd_lpc43xx.c (100%) rename {tinyusb/device => hw/mcu/nxp/lpc43xx/hal_mcu}/dcd_lpc43xx.h (100%) diff --git a/hw/mcu/nxp/lpc11uxx/hal_mcu/hal_lpc11uxx.c b/hw/mcu/nxp/lpc11uxx/hal_mcu/hal_lpc11uxx.c index 066679a27..c8f5b490b 100644 --- a/hw/mcu/nxp/lpc11uxx/hal_mcu/hal_lpc11uxx.c +++ b/hw/mcu/nxp/lpc11uxx/hal_mcu/hal_lpc11uxx.c @@ -53,7 +53,7 @@ void hal_usb_int_disable(uint8_t coreid) NVIC_DisableIRQ(USB_IRQn); } -bool hal_init(void) +bool hal_usb_init(void) { // TODO remove magic number /* Enable AHB clock to the USB block and USB RAM. */ diff --git a/hw/mcu/nxp/lpc13uxx/hal_mcu/hal_lpc13uxx.c b/hw/mcu/nxp/lpc13uxx/hal_mcu/hal_lpc13uxx.c index 9de859e6f..2f13a2f98 100644 --- a/hw/mcu/nxp/lpc13uxx/hal_mcu/hal_lpc13uxx.c +++ b/hw/mcu/nxp/lpc13uxx/hal_mcu/hal_lpc13uxx.c @@ -53,7 +53,7 @@ void hal_usb_int_disable(uint8_t coreid) NVIC_DisableIRQ(USB_IRQ_IRQn); } -bool hal_init(void) +bool hal_usb_init(void) { // TODO remove magic number LPC_SYSCON->SYSAHBCLKCTRL |= ((0x1<<14) | (0x1<<27)); /* Enable AHB clock to the USB block and USB RAM. */ diff --git a/hw/mcu/nxp/lpc175x_6x/hal_mcu/hal_lpc175x_6x.c b/hw/mcu/nxp/lpc175x_6x/hal_mcu/hal_lpc175x_6x.c index 59a56cc2e..b84cf12f4 100644 --- a/hw/mcu/nxp/lpc175x_6x/hal_mcu/hal_lpc175x_6x.c +++ b/hw/mcu/nxp/lpc175x_6x/hal_mcu/hal_lpc175x_6x.c @@ -56,7 +56,7 @@ void hal_usb_int_disable(uint8_t coreid) //--------------------------------------------------------------------+ // IMPLEMENTATION //--------------------------------------------------------------------+ -bool hal_init(void) +bool hal_usb_init(void) { enum { USBCLK_DEVCIE = 0x12, // AHB + Device diff --git a/tinyusb/device/dcd_lpc43xx.c b/hw/mcu/nxp/lpc43xx/hal_mcu/dcd_lpc43xx.c similarity index 100% rename from tinyusb/device/dcd_lpc43xx.c rename to hw/mcu/nxp/lpc43xx/hal_mcu/dcd_lpc43xx.c diff --git a/tinyusb/device/dcd_lpc43xx.h b/hw/mcu/nxp/lpc43xx/hal_mcu/dcd_lpc43xx.h similarity index 100% rename from tinyusb/device/dcd_lpc43xx.h rename to hw/mcu/nxp/lpc43xx/hal_mcu/dcd_lpc43xx.h diff --git a/hw/mcu/nxp/lpc43xx/hal_mcu/hal_lpc43xx.c b/hw/mcu/nxp/lpc43xx/hal_mcu/hal_lpc43xx.c index a17918991..0e12717bc 100644 --- a/hw/mcu/nxp/lpc43xx/hal_mcu/hal_lpc43xx.c +++ b/hw/mcu/nxp/lpc43xx/hal_mcu/hal_lpc43xx.c @@ -79,7 +79,7 @@ static void hal_controller_reset(uint8_t coreid) // return timeout_expired(&timeout) ? TUSB_ERROR_OSAL_TIMEOUT : TUSB_ERROR_NONE; } -bool hal_init(void) +bool hal_usb_init(void) { LPC_CREG->CREG0 &= ~(1<<5); /* Turn on the phy */ diff --git a/tinyusb/device/usbd_dcd.h b/tinyusb/device/usbd_dcd.h index f6b085cfe..a82da8399 100644 --- a/tinyusb/device/usbd_dcd.h +++ b/tinyusb/device/usbd_dcd.h @@ -73,6 +73,8 @@ typedef struct { }usbd_device_info_t; extern usbd_device_info_t usbd_devices[CONTROLLER_DEVICE_NUMBER]; + + //--------------------------------------------------------------------+ // callback from DCD ISR //--------------------------------------------------------------------+ diff --git a/tinyusb/tusb.c b/tinyusb/tusb.c index 6b3842029..156aecee5 100644 --- a/tinyusb/tusb.c +++ b/tinyusb/tusb.c @@ -42,7 +42,7 @@ tusb_error_t tusb_init(void) { - VERIFY( hal_init(), TUSB_ERROR_FAILED ) ; // hardware init + VERIFY( hal_usb_init(), TUSB_ERROR_FAILED ) ; // hardware init #if MODE_HOST_SUPPORTED ASSERT_STATUS( usbh_init() ); // host stack init diff --git a/tinyusb/tusb_hal.h b/tinyusb/tusb_hal.h index a99c58ccd..2128702f3 100644 --- a/tinyusb/tusb_hal.h +++ b/tinyusb/tusb_hal.h @@ -71,7 +71,7 @@ extern "C" { * \returns true if succeedded * \note This function is invoked by \ref tusb_init as part of the initialization. */ -bool hal_init(void); +bool hal_usb_init(void); /** \brief Enable USB Interrupt on a specific USB Controller * \param[in] coreid is a zero-based index to identify USB controller's ID