From 4a5a53b3b88fcd2f5ec7f1f94eb07c27cb1e9bec Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 23 Feb 2022 18:42:32 +0700 Subject: improve rphort management for usbd --- src/class/cdc/cdc_rndis_host.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/class') diff --git a/src/class/cdc/cdc_rndis_host.c b/src/class/cdc/cdc_rndis_host.c index cc4ffd1cf..d41cf91ac 100644 --- a/src/class/cdc/cdc_rndis_host.c +++ b/src/class/cdc/cdc_rndis_host.c @@ -35,6 +35,16 @@ #include "cdc_host.h" #include "cdc_rndis_host.h" +#if 0 // TODO remove subtask related macros later +// Sub Task +#define OSAL_SUBTASK_BEGIN +#define OSAL_SUBTASK_END return TUSB_ERROR_NONE; + +#define STASK_RETURN(_error) return _error; +#define STASK_INVOKE(_subtask, _status) (_status) = _subtask +#define STASK_ASSERT(_cond) TU_VERIFY(_cond, TUSB_ERROR_OSAL_TASK_FAILED) +#endif + //--------------------------------------------------------------------+ // MACRO CONSTANT TYPEDEF //--------------------------------------------------------------------+ -- cgit v1.3.1 From d10326cb4e0f48a05bc39c6f51b7b0fb29427cc9 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 23 Feb 2022 21:46:40 +0700 Subject: rename TUSB_OPT_DEVICE_ENABLED to CFG_TUD_ENABLED TUSB_OPT_DEVICE_ENABLED still usable for backward compatible --- hw/bsp/board.h | 2 +- hw/bsp/brtmm90x/family.c | 6 +++--- hw/bsp/d5035_01/d5035_01.c | 2 +- hw/bsp/da14695_dk_usb/da14695_dk_usb.c | 2 +- hw/bsp/da1469x_dk_pro/da1469x-dk-pro.c | 4 ++-- hw/bsp/frdm_kl25z/frdm_kl25z.c | 2 +- hw/bsp/lpcxpresso1769/lpcxpresso1769.c | 2 +- hw/bsp/mbed1768/mbed1768.c | 2 +- hw/bsp/msp432e4/family.c | 4 ++-- hw/bsp/nrf/family.c | 2 +- hw/bsp/rp2040/family.c | 2 +- hw/bsp/rx/boards/rx65n_target/rx65n_target.c | 2 +- hw/bsp/same54xplainedpro/same54xplainedpro.c | 2 +- hw/bsp/tm4c123/family.c | 2 +- src/class/audio/audio_device.c | 4 ++-- src/class/bth/bth_device.c | 2 +- src/class/cdc/cdc_device.c | 2 +- src/class/dfu/dfu_device.c | 2 +- src/class/dfu/dfu_rt_device.c | 2 +- src/class/hid/hid_device.c | 2 +- src/class/midi/midi_device.c | 2 +- src/class/msc/msc_device.c | 2 +- src/class/net/ecm_rndis_device.c | 2 +- src/class/net/ncm_device.c | 2 +- src/class/usbtmc/usbtmc_device.c | 2 +- src/class/vendor/vendor_device.c | 2 +- src/class/video/video_device.c | 2 +- src/device/usbd.c | 2 +- src/device/usbd_control.c | 2 +- src/portable/bridgetek/ft9xx/dcd_ft9xx.c | 2 +- src/portable/broadcom/synopsys/dcd_synopsys.c | 2 +- src/portable/chipidea/ci_hs/dcd_ci_hs.c | 2 +- src/portable/dialog/da146xx/dcd_da146xx.c | 2 +- src/portable/espressif/esp32sx/dcd_esp32sx.c | 2 +- src/portable/mentor/musb/dcd_musb.c | 2 +- src/portable/microchip/pic32mz/dcd_pic32mz.c | 2 +- src/portable/microchip/samd/dcd_samd.c | 2 +- src/portable/microchip/samx7x/dcd_samx7x.c | 2 +- src/portable/mindmotion/mm32/dcd_mm32f327x_otg.c | 2 +- src/portable/nordic/nrf5x/dcd_nrf5x.c | 2 +- src/portable/nuvoton/nuc120/dcd_nuc120.c | 2 +- src/portable/nuvoton/nuc121/dcd_nuc121.c | 2 +- src/portable/nuvoton/nuc505/dcd_nuc505.c | 2 +- src/portable/nxp/khci/dcd_khci.c | 2 +- src/portable/nxp/lpc17_40/dcd_lpc17_40.c | 2 +- src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c | 2 +- src/portable/nxp/transdimension/dcd_transdimension.c | 2 +- src/portable/raspberrypi/rp2040/dcd_rp2040.c | 2 +- src/portable/renesas/usba/dcd_usba.c | 2 +- src/portable/sony/cxd56/dcd_cxd56.c | 2 +- src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c | 2 +- src/portable/st/synopsys/dcd_synopsys.c | 2 +- src/portable/sunxi/dcd_sunxi_musb.c | 2 +- src/portable/synopsys/dwc2/dcd_dwc2.c | 2 +- src/portable/ti/msp430x5xx/dcd_msp430x5xx.c | 2 +- src/portable/valentyusb/eptri/dcd_eptri.c | 2 +- src/tusb.c | 8 ++++---- src/tusb.h | 2 +- src/tusb_option.h | 5 ++++- 59 files changed, 70 insertions(+), 67 deletions(-) (limited to 'src/class') diff --git a/hw/bsp/board.h b/hw/bsp/board.h index 782e0939c..b4e0cb298 100644 --- a/hw/bsp/board.h +++ b/hw/bsp/board.h @@ -120,7 +120,7 @@ static inline void board_delay(uint32_t ms) uint32_t start_ms = board_millis(); while (board_millis() - start_ms < ms) { - #if TUSB_OPT_DEVICE_ENABLED + #if CFG_TUD_ENABLED // take chance to run usb background tud_task(); #endif diff --git a/hw/bsp/brtmm90x/family.c b/hw/bsp/brtmm90x/family.c index 803a62a95..6b3c1f56c 100644 --- a/hw/bsp/brtmm90x/family.c +++ b/hw/bsp/brtmm90x/family.c @@ -30,7 +30,7 @@ #include #include -#if TUSB_OPT_DEVICE_ENABLED +#if CFG_TUD_ENABLED int8_t board_ft90x_vbus(void); // Board specific implementation of VBUS detection for USB device. extern void ft90x_usbd_pm_ISR(uint16_t pmcfg); // Interrupt handler for USB device power management #endif @@ -152,14 +152,14 @@ void board_pm_ISR(void) MASK_SYS_PMCFG_HOST_RESUME_DEV) ) { -#if TUSB_OPT_DEVICE_ENABLED +#if CFG_TUD_ENABLED ft90x_usbd_pm_ISR(pmcfg); #endif } #endif } -#if TUSB_OPT_DEVICE_ENABLED +#if CFG_TUD_ENABLED int8_t board_ft90x_vbus(void) { return gpio_read(USBD_VBUS_DTC_PIN); diff --git a/hw/bsp/d5035_01/d5035_01.c b/hw/bsp/d5035_01/d5035_01.c index 5685ff16f..f356851f7 100644 --- a/hw/bsp/d5035_01/d5035_01.c +++ b/hw/bsp/d5035_01/d5035_01.c @@ -270,7 +270,7 @@ void board_init(void) #endif -#if TUSB_OPT_DEVICE_ENABLED +#if CFG_TUD_ENABLED #if CFG_TUSB_DEBUG >= 2 uart_send_str(BOARD_NAME " USB device enabled\n"); #endif diff --git a/hw/bsp/da14695_dk_usb/da14695_dk_usb.c b/hw/bsp/da14695_dk_usb/da14695_dk_usb.c index 95fe70d01..a4d996810 100644 --- a/hw/bsp/da14695_dk_usb/da14695_dk_usb.c +++ b/hw/bsp/da14695_dk_usb/da14695_dk_usb.c @@ -73,7 +73,7 @@ void board_init(void) // 1ms tick timer SysTick_Config(SystemCoreClock / 1000); -#if TUSB_OPT_DEVICE_ENABLED +#if CFG_TUD_ENABLED // This board is USB powered there is no need to monitor // VBUS line. Notify driver that VBUS is present. tusb_vbus_changed(true); diff --git a/hw/bsp/da1469x_dk_pro/da1469x-dk-pro.c b/hw/bsp/da1469x_dk_pro/da1469x-dk-pro.c index 0441c000c..13113fb95 100644 --- a/hw/bsp/da1469x_dk_pro/da1469x-dk-pro.c +++ b/hw/bsp/da1469x_dk_pro/da1469x-dk-pro.c @@ -36,7 +36,7 @@ void USB_IRQHandler(void) tud_int_handler(0); } -#if TUSB_OPT_DEVICE_ENABLED +#if CFG_TUD_ENABLED // DA146xx driver function that must be called whenever VBUS changes extern void tusb_vbus_changed(bool present); @@ -85,7 +85,7 @@ void board_init(void) // 1ms tick timer SysTick_Config(SystemCoreClock / 1000); -#if TUSB_OPT_DEVICE_ENABLED +#if CFG_TUD_ENABLED // Setup interrupt for both connect and disconnect CRG_TOP->VBUS_IRQ_MASK_REG = CRG_TOP_VBUS_IRQ_MASK_REG_VBUS_IRQ_EN_FALL_Msk | CRG_TOP_VBUS_IRQ_MASK_REG_VBUS_IRQ_EN_RISE_Msk; diff --git a/hw/bsp/frdm_kl25z/frdm_kl25z.c b/hw/bsp/frdm_kl25z/frdm_kl25z.c index 2930ed56e..5f2a5b23d 100644 --- a/hw/bsp/frdm_kl25z/frdm_kl25z.c +++ b/hw/bsp/frdm_kl25z/frdm_kl25z.c @@ -42,7 +42,7 @@ void USB0_IRQHandler(void) #if TUSB_OPT_HOST_ENABLED tuh_int_handler(0); #endif -#if TUSB_OPT_DEVICE_ENABLED +#if CFG_TUD_ENABLED tud_int_handler(0); #endif } diff --git a/hw/bsp/lpcxpresso1769/lpcxpresso1769.c b/hw/bsp/lpcxpresso1769/lpcxpresso1769.c index 101cc8a4c..e62544390 100644 --- a/hw/bsp/lpcxpresso1769/lpcxpresso1769.c +++ b/hw/bsp/lpcxpresso1769/lpcxpresso1769.c @@ -156,7 +156,7 @@ void board_init(void) // 0x1B // Host + Device + OTG + AHB }; - uint32_t const clk_en = TUSB_OPT_DEVICE_ENABLED ? USBCLK_DEVCIE : USBCLK_HOST; + uint32_t const clk_en = CFG_TUD_ENABLED ? USBCLK_DEVCIE : USBCLK_HOST; LPC_USB->OTGClkCtrl = clk_en; while ( (LPC_USB->OTGClkSt & clk_en) != clk_en ); diff --git a/hw/bsp/mbed1768/mbed1768.c b/hw/bsp/mbed1768/mbed1768.c index 5495ed166..85dffde77 100644 --- a/hw/bsp/mbed1768/mbed1768.c +++ b/hw/bsp/mbed1768/mbed1768.c @@ -130,7 +130,7 @@ void board_init(void) // 0x1B // Host + Device + OTG + AHB }; - uint32_t const clk_en = TUSB_OPT_DEVICE_ENABLED ? USBCLK_DEVCIE : USBCLK_HOST; + uint32_t const clk_en = CFG_TUD_ENABLED ? USBCLK_DEVCIE : USBCLK_HOST; LPC_USB->OTGClkCtrl = clk_en; while ( (LPC_USB->OTGClkSt & clk_en) != clk_en ); diff --git a/hw/bsp/msp432e4/family.c b/hw/bsp/msp432e4/family.c index 262dc1d30..d553b362e 100644 --- a/hw/bsp/msp432e4/family.c +++ b/hw/bsp/msp432e4/family.c @@ -36,7 +36,7 @@ void USB0_IRQHandler(void) #if TUSB_OPT_HOST_ENABLED tuh_int_handler(0); #endif -#if TUSB_OPT_DEVICE_ENABLED +#if CFG_TUD_ENABLED tud_int_handler(0); #endif } @@ -148,7 +148,7 @@ void board_init(void) USB0->GPCS = USB_GPCS_DEVMOD_OTG; USB0->EPC = USB_EPC_EPENDE | USB_EPC_EPEN_HIGH; #endif -#if TUSB_OPT_DEVICE_ENABLED +#if CFG_TUD_ENABLED USB0->GPCS = USB_GPCS_DEVMOD_DEVVBUS; #endif } diff --git a/hw/bsp/nrf/family.c b/hw/bsp/nrf/family.c index ed742daaf..a07332d4c 100644 --- a/hw/bsp/nrf/family.c +++ b/hw/bsp/nrf/family.c @@ -100,7 +100,7 @@ void board_init(void) nrfx_uarte_init(&_uart_id, &uart_cfg, NULL); //uart_handler); //------------- USB -------------// -#if TUSB_OPT_DEVICE_ENABLED +#if CFG_TUD_ENABLED // Priorities 0, 1, 4 (nRF52) are reserved for SoftDevice // 2 is highest for application NVIC_SetPriority(USBD_IRQn, 2); diff --git a/hw/bsp/rp2040/family.c b/hw/bsp/rp2040/family.c index 10ead2776..6d0f7ed38 100644 --- a/hw/bsp/rp2040/family.c +++ b/hw/bsp/rp2040/family.c @@ -138,7 +138,7 @@ void board_init(void) #endif // todo probably set up device mode? -#if TUSB_OPT_DEVICE_ENABLED +#if CFG_TUD_ENABLED #endif diff --git a/hw/bsp/rx/boards/rx65n_target/rx65n_target.c b/hw/bsp/rx/boards/rx65n_target/rx65n_target.c index d658ee5dd..56bf575b2 100644 --- a/hw/bsp/rx/boards/rx65n_target/rx65n_target.c +++ b/hw/bsp/rx/boards/rx65n_target/rx65n_target.c @@ -179,7 +179,7 @@ void INT_Excep_USB0_USBI0(void) #if TUSB_OPT_HOST_ENABLED tuh_int_handler(0); #endif -#if TUSB_OPT_DEVICE_ENABLED +#if CFG_TUD_ENABLED tud_int_handler(0); #endif } diff --git a/hw/bsp/same54xplainedpro/same54xplainedpro.c b/hw/bsp/same54xplainedpro/same54xplainedpro.c index 4c38fc6eb..ba1eec38b 100644 --- a/hw/bsp/same54xplainedpro/same54xplainedpro.c +++ b/hw/bsp/same54xplainedpro/same54xplainedpro.c @@ -223,7 +223,7 @@ void board_init(void) #endif -#if TUSB_OPT_DEVICE_ENABLED +#if CFG_TUD_ENABLED #if CFG_TUSB_DEBUG >= 2 uart_send_str(BOARD_NAME " USB device enabled\n"); #endif diff --git a/hw/bsp/tm4c123/family.c b/hw/bsp/tm4c123/family.c index 449781ce1..1e19e7f43 100644 --- a/hw/bsp/tm4c123/family.c +++ b/hw/bsp/tm4c123/family.c @@ -11,7 +11,7 @@ void USB0_Handler(void) tuh_int_handler(0); #endif -#if TUSB_OPT_DEVICE_ENABLED +#if CFG_TUD_ENABLED tud_int_handler(0); #endif } diff --git a/src/class/audio/audio_device.c b/src/class/audio/audio_device.c index d21980060..06979b09e 100644 --- a/src/class/audio/audio_device.c +++ b/src/class/audio/audio_device.c @@ -50,7 +50,7 @@ #include "tusb_option.h" -#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_AUDIO) +#if (CFG_TUD_ENABLED && CFG_TUD_AUDIO) //--------------------------------------------------------------------+ // INCLUDE @@ -2291,4 +2291,4 @@ uint8_t audiod_get_audio_fct_idx(audiod_function_t * audio) return 0; } -#endif //TUSB_OPT_DEVICE_ENABLED && CFG_TUD_AUDIO +#endif //CFG_TUD_ENABLED && CFG_TUD_AUDIO diff --git a/src/class/bth/bth_device.c b/src/class/bth/bth_device.c index 8ef609622..f40bfbd0d 100755 --- a/src/class/bth/bth_device.c +++ b/src/class/bth/bth_device.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_BTH) +#if (CFG_TUD_ENABLED && CFG_TUD_BTH) //--------------------------------------------------------------------+ // INCLUDE diff --git a/src/class/cdc/cdc_device.c b/src/class/cdc/cdc_device.c index 08f2af253..2b9b84e7a 100644 --- a/src/class/cdc/cdc_device.c +++ b/src/class/cdc/cdc_device.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_CDC) +#if (CFG_TUD_ENABLED && CFG_TUD_CDC) #include "device/usbd.h" #include "device/usbd_pvt.h" diff --git a/src/class/dfu/dfu_device.c b/src/class/dfu/dfu_device.c index ddfa608e4..8d859d2ee 100644 --- a/src/class/dfu/dfu_device.c +++ b/src/class/dfu/dfu_device.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_DFU) +#if (CFG_TUD_ENABLED && CFG_TUD_DFU) #include "device/usbd.h" #include "device/usbd_pvt.h" diff --git a/src/class/dfu/dfu_rt_device.c b/src/class/dfu/dfu_rt_device.c index afee2aa1f..b9cd6096b 100644 --- a/src/class/dfu/dfu_rt_device.c +++ b/src/class/dfu/dfu_rt_device.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_DFU_RUNTIME) +#if (CFG_TUD_ENABLED && CFG_TUD_DFU_RUNTIME) #include "device/usbd.h" #include "device/usbd_pvt.h" diff --git a/src/class/hid/hid_device.c b/src/class/hid/hid_device.c index 588b61254..562ca7f36 100644 --- a/src/class/hid/hid_device.c +++ b/src/class/hid/hid_device.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_HID) +#if (CFG_TUD_ENABLED && CFG_TUD_HID) //--------------------------------------------------------------------+ // INCLUDE diff --git a/src/class/midi/midi_device.c b/src/class/midi/midi_device.c index b08b362f9..2ce1376bd 100644 --- a/src/class/midi/midi_device.c +++ b/src/class/midi/midi_device.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_MIDI) +#if (CFG_TUD_ENABLED && CFG_TUD_MIDI) //--------------------------------------------------------------------+ // INCLUDE diff --git a/src/class/msc/msc_device.c b/src/class/msc/msc_device.c index e09a2b11a..318947a67 100644 --- a/src/class/msc/msc_device.c +++ b/src/class/msc/msc_device.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_MSC) +#if (CFG_TUD_ENABLED && CFG_TUD_MSC) #include "device/usbd.h" #include "device/usbd_pvt.h" diff --git a/src/class/net/ecm_rndis_device.c b/src/class/net/ecm_rndis_device.c index c6cd388e3..f6b318058 100644 --- a/src/class/net/ecm_rndis_device.c +++ b/src/class/net/ecm_rndis_device.c @@ -27,7 +27,7 @@ #include "tusb_option.h" -#if ( TUSB_OPT_DEVICE_ENABLED && CFG_TUD_ECM_RNDIS ) +#if ( CFG_TUD_ENABLED && CFG_TUD_ECM_RNDIS ) #include "device/usbd.h" #include "device/usbd_pvt.h" diff --git a/src/class/net/ncm_device.c b/src/class/net/ncm_device.c index 3e131a85c..1987337f8 100644 --- a/src/class/net/ncm_device.c +++ b/src/class/net/ncm_device.c @@ -28,7 +28,7 @@ #include "tusb_option.h" -#if ( TUSB_OPT_DEVICE_ENABLED && CFG_TUD_NCM ) +#if ( CFG_TUD_ENABLED && CFG_TUD_NCM ) #include "device/usbd.h" #include "device/usbd_pvt.h" diff --git a/src/class/usbtmc/usbtmc_device.c b/src/class/usbtmc/usbtmc_device.c index 26be987cf..b02b07575 100644 --- a/src/class/usbtmc/usbtmc_device.c +++ b/src/class/usbtmc/usbtmc_device.c @@ -68,7 +68,7 @@ #include "tusb_option.h" -#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_USBTMC) +#if (CFG_TUD_ENABLED && CFG_TUD_USBTMC) #include "device/usbd.h" #include "device/usbd_pvt.h" diff --git a/src/class/vendor/vendor_device.c b/src/class/vendor/vendor_device.c index 8a4ca1d2e..394b39b27 100644 --- a/src/class/vendor/vendor_device.c +++ b/src/class/vendor/vendor_device.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_VENDOR) +#if (CFG_TUD_ENABLED && CFG_TUD_VENDOR) #include "device/usbd.h" #include "device/usbd_pvt.h" diff --git a/src/class/video/video_device.c b/src/class/video/video_device.c index eeb068197..91718f205 100644 --- a/src/class/video/video_device.c +++ b/src/class/video/video_device.c @@ -27,7 +27,7 @@ #include "tusb_option.h" -#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_VIDEO && CFG_TUD_VIDEO_STREAMING) +#if (CFG_TUD_ENABLED && CFG_TUD_VIDEO && CFG_TUD_VIDEO_STREAMING) #include "device/usbd.h" #include "device/usbd_pvt.h" diff --git a/src/device/usbd.c b/src/device/usbd.c index 37ca9822f..e6861ee0a 100644 --- a/src/device/usbd.c +++ b/src/device/usbd.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED +#if CFG_TUD_ENABLED #include "tusb.h" #include "device/usbd.h" diff --git a/src/device/usbd_control.c b/src/device/usbd_control.c index 7a8244699..4f4108090 100644 --- a/src/device/usbd_control.c +++ b/src/device/usbd_control.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED +#if CFG_TUD_ENABLED #include "tusb.h" #include "device/usbd_pvt.h" diff --git a/src/portable/bridgetek/ft9xx/dcd_ft9xx.c b/src/portable/bridgetek/ft9xx/dcd_ft9xx.c index d46723caa..791f6cf60 100644 --- a/src/portable/bridgetek/ft9xx/dcd_ft9xx.c +++ b/src/portable/bridgetek/ft9xx/dcd_ft9xx.c @@ -31,7 +31,7 @@ #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED && \ +#if CFG_TUD_ENABLED && \ (CFG_TUSB_MCU == OPT_MCU_FT90X || CFG_TUSB_MCU == OPT_MCU_FT93X) #include diff --git a/src/portable/broadcom/synopsys/dcd_synopsys.c b/src/portable/broadcom/synopsys/dcd_synopsys.c index 494bb70ee..c4881ee50 100644 --- a/src/portable/broadcom/synopsys/dcd_synopsys.c +++ b/src/portable/broadcom/synopsys/dcd_synopsys.c @@ -29,7 +29,7 @@ #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED && \ +#if CFG_TUD_ENABLED && \ (CFG_TUSB_MCU == OPT_MCU_BCM2711 ) \ diff --git a/src/portable/chipidea/ci_hs/dcd_ci_hs.c b/src/portable/chipidea/ci_hs/dcd_ci_hs.c index c943396fc..ffb2ebd16 100644 --- a/src/portable/chipidea/ci_hs/dcd_ci_hs.c +++ b/src/portable/chipidea/ci_hs/dcd_ci_hs.c @@ -27,7 +27,7 @@ #include "tusb_option.h" #include "device/dcd_attr.h" -#if TUSB_OPT_DEVICE_ENABLED && defined(DCD_ATTR_CONTROLLER_CHIPIDEA_HS) +#if CFG_TUD_ENABLED && defined(DCD_ATTR_CONTROLLER_CHIPIDEA_HS) //--------------------------------------------------------------------+ // INCLUDE diff --git a/src/portable/dialog/da146xx/dcd_da146xx.c b/src/portable/dialog/da146xx/dcd_da146xx.c index 02fad8165..919249a09 100644 --- a/src/portable/dialog/da146xx/dcd_da146xx.c +++ b/src/portable/dialog/da146xx/dcd_da146xx.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED && CFG_TUSB_MCU == OPT_MCU_DA1469X +#if CFG_TUD_ENABLED && CFG_TUSB_MCU == OPT_MCU_DA1469X #include "mcu/mcu.h" diff --git a/src/portable/espressif/esp32sx/dcd_esp32sx.c b/src/portable/espressif/esp32sx/dcd_esp32sx.c index a9c311324..99cd08e4d 100644 --- a/src/portable/espressif/esp32sx/dcd_esp32sx.c +++ b/src/portable/espressif/esp32sx/dcd_esp32sx.c @@ -28,7 +28,7 @@ #include "tusb_option.h" -#if (((CFG_TUSB_MCU == OPT_MCU_ESP32S2) || (CFG_TUSB_MCU == OPT_MCU_ESP32S3)) && TUSB_OPT_DEVICE_ENABLED) +#if (((CFG_TUSB_MCU == OPT_MCU_ESP32S2) || (CFG_TUSB_MCU == OPT_MCU_ESP32S3)) && CFG_TUD_ENABLED) // Espressif #include "freertos/xtensa_api.h" diff --git a/src/portable/mentor/musb/dcd_musb.c b/src/portable/mentor/musb/dcd_musb.c index f6e05e134..71414e737 100644 --- a/src/portable/mentor/musb/dcd_musb.c +++ b/src/portable/mentor/musb/dcd_musb.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED && \ +#if CFG_TUD_ENABLED && \ TU_CHECK_MCU(OPT_MCU_MSP432E4, OPT_MCU_TM4C123, OPT_MCU_TM4C129) #if __GNUC__ > 8 && defined(__ARM_FEATURE_UNALIGNED) diff --git a/src/portable/microchip/pic32mz/dcd_pic32mz.c b/src/portable/microchip/pic32mz/dcd_pic32mz.c index 740e5edbb..7d48f755b 100644 --- a/src/portable/microchip/pic32mz/dcd_pic32mz.c +++ b/src/portable/microchip/pic32mz/dcd_pic32mz.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED && CFG_TUSB_MCU == OPT_MCU_PIC32MZ +#if CFG_TUD_ENABLED && CFG_TUSB_MCU == OPT_MCU_PIC32MZ #include #include diff --git a/src/portable/microchip/samd/dcd_samd.c b/src/portable/microchip/samd/dcd_samd.c index 46aabc5aa..c4ee6f2f5 100644 --- a/src/portable/microchip/samd/dcd_samd.c +++ b/src/portable/microchip/samd/dcd_samd.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED && \ +#if CFG_TUD_ENABLED && \ (CFG_TUSB_MCU == OPT_MCU_SAMD11 || CFG_TUSB_MCU == OPT_MCU_SAMD21 || \ CFG_TUSB_MCU == OPT_MCU_SAMD51 || CFG_TUSB_MCU == OPT_MCU_SAME5X || \ CFG_TUSB_MCU == OPT_MCU_SAML22 || CFG_TUSB_MCU == OPT_MCU_SAML21) diff --git a/src/portable/microchip/samx7x/dcd_samx7x.c b/src/portable/microchip/samx7x/dcd_samx7x.c index 9e3b43840..a82f29a88 100644 --- a/src/portable/microchip/samx7x/dcd_samx7x.c +++ b/src/portable/microchip/samx7x/dcd_samx7x.c @@ -27,7 +27,7 @@ #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED && CFG_TUSB_MCU == OPT_MCU_SAMX7X +#if CFG_TUD_ENABLED && CFG_TUSB_MCU == OPT_MCU_SAMX7X #include "device/dcd.h" #include "sam.h" diff --git a/src/portable/mindmotion/mm32/dcd_mm32f327x_otg.c b/src/portable/mindmotion/mm32/dcd_mm32f327x_otg.c index a3b69b987..1edcd8458 100644 --- a/src/portable/mindmotion/mm32/dcd_mm32f327x_otg.c +++ b/src/portable/mindmotion/mm32/dcd_mm32f327x_otg.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED && ( CFG_TUSB_MCU == OPT_MCU_MM32F327X ) +#if CFG_TUD_ENABLED && ( CFG_TUSB_MCU == OPT_MCU_MM32F327X ) #include "reg_usb_otg_fs.h" #include "mm32_device.h" diff --git a/src/portable/nordic/nrf5x/dcd_nrf5x.c b/src/portable/nordic/nrf5x/dcd_nrf5x.c index 024ea0d90..bc145eaa4 100644 --- a/src/portable/nordic/nrf5x/dcd_nrf5x.c +++ b/src/portable/nordic/nrf5x/dcd_nrf5x.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED && CFG_TUSB_MCU == OPT_MCU_NRF5X +#if CFG_TUD_ENABLED && CFG_TUSB_MCU == OPT_MCU_NRF5X #include "nrf.h" #include "nrf_clock.h" diff --git a/src/portable/nuvoton/nuc120/dcd_nuc120.c b/src/portable/nuvoton/nuc120/dcd_nuc120.c index 0d45090d1..694766613 100644 --- a/src/portable/nuvoton/nuc120/dcd_nuc120.c +++ b/src/portable/nuvoton/nuc120/dcd_nuc120.c @@ -35,7 +35,7 @@ #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED && (CFG_TUSB_MCU == OPT_MCU_NUC120) +#if CFG_TUD_ENABLED && (CFG_TUSB_MCU == OPT_MCU_NUC120) #include "device/dcd.h" #include "NUC100Series.h" diff --git a/src/portable/nuvoton/nuc121/dcd_nuc121.c b/src/portable/nuvoton/nuc121/dcd_nuc121.c index fc7150508..88d514bce 100644 --- a/src/portable/nuvoton/nuc121/dcd_nuc121.c +++ b/src/portable/nuvoton/nuc121/dcd_nuc121.c @@ -35,7 +35,7 @@ #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED && ( (CFG_TUSB_MCU == OPT_MCU_NUC121) || (CFG_TUSB_MCU == OPT_MCU_NUC126) ) +#if CFG_TUD_ENABLED && ( (CFG_TUSB_MCU == OPT_MCU_NUC121) || (CFG_TUSB_MCU == OPT_MCU_NUC126) ) #include "device/dcd.h" #include "NuMicro.h" diff --git a/src/portable/nuvoton/nuc505/dcd_nuc505.c b/src/portable/nuvoton/nuc505/dcd_nuc505.c index aefb09f4e..498977561 100644 --- a/src/portable/nuvoton/nuc505/dcd_nuc505.c +++ b/src/portable/nuvoton/nuc505/dcd_nuc505.c @@ -35,7 +35,7 @@ #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED && (CFG_TUSB_MCU == OPT_MCU_NUC505) +#if CFG_TUD_ENABLED && (CFG_TUSB_MCU == OPT_MCU_NUC505) #include "device/dcd.h" #include "NUC505Series.h" diff --git a/src/portable/nxp/khci/dcd_khci.c b/src/portable/nxp/khci/dcd_khci.c index 8de924f90..4c7737103 100644 --- a/src/portable/nxp/khci/dcd_khci.c +++ b/src/portable/nxp/khci/dcd_khci.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED && ( \ +#if CFG_TUD_ENABLED && ( \ ( CFG_TUSB_MCU == OPT_MCU_MKL25ZXX ) || ( CFG_TUSB_MCU == OPT_MCU_K32L2BXX ) \ ) diff --git a/src/portable/nxp/lpc17_40/dcd_lpc17_40.c b/src/portable/nxp/lpc17_40/dcd_lpc17_40.c index 0f500a88f..d2cce2db3 100644 --- a/src/portable/nxp/lpc17_40/dcd_lpc17_40.c +++ b/src/portable/nxp/lpc17_40/dcd_lpc17_40.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED && \ +#if CFG_TUD_ENABLED && \ (CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC40XX) #include "device/dcd.h" diff --git a/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c b/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c index 1bdf72d6d..55d872dc0 100644 --- a/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c +++ b/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c @@ -34,7 +34,7 @@ * - LPC54114 * - LPC55s69 */ -#if TUSB_OPT_DEVICE_ENABLED && ( CFG_TUSB_MCU == OPT_MCU_LPC11UXX || \ +#if CFG_TUD_ENABLED && ( CFG_TUSB_MCU == OPT_MCU_LPC11UXX || \ CFG_TUSB_MCU == OPT_MCU_LPC13XX || \ CFG_TUSB_MCU == OPT_MCU_LPC15XX || \ CFG_TUSB_MCU == OPT_MCU_LPC51UXX || \ diff --git a/src/portable/nxp/transdimension/dcd_transdimension.c b/src/portable/nxp/transdimension/dcd_transdimension.c index f6433293d..9f5979ab4 100644 --- a/src/portable/nxp/transdimension/dcd_transdimension.c +++ b/src/portable/nxp/transdimension/dcd_transdimension.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED && \ +#if CFG_TUD_ENABLED && \ (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX) #warning "transdimenion is renamed to chipidea (portable/chipidea/ci_hs) to match other opensource naming convention such as linux. This file will be removed in the future, please update your makefile accordingly" diff --git a/src/portable/raspberrypi/rp2040/dcd_rp2040.c b/src/portable/raspberrypi/rp2040/dcd_rp2040.c index 42add3167..915822798 100644 --- a/src/portable/raspberrypi/rp2040/dcd_rp2040.c +++ b/src/portable/raspberrypi/rp2040/dcd_rp2040.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED && CFG_TUSB_MCU == OPT_MCU_RP2040 +#if CFG_TUD_ENABLED && CFG_TUSB_MCU == OPT_MCU_RP2040 #include "pico.h" #include "rp2040_usb.h" diff --git a/src/portable/renesas/usba/dcd_usba.c b/src/portable/renesas/usba/dcd_usba.c index ae7d2fd0c..eb3541af4 100644 --- a/src/portable/renesas/usba/dcd_usba.c +++ b/src/portable/renesas/usba/dcd_usba.c @@ -31,7 +31,7 @@ // We disable SOF for now until needed later on #define USE_SOF 0 -#if TUSB_OPT_DEVICE_ENABLED && ( CFG_TUSB_MCU == OPT_MCU_RX63X || \ +#if CFG_TUD_ENABLED && ( CFG_TUSB_MCU == OPT_MCU_RX63X || \ CFG_TUSB_MCU == OPT_MCU_RX65X || \ CFG_TUSB_MCU == OPT_MCU_RX72N ) #include "device/dcd.h" diff --git a/src/portable/sony/cxd56/dcd_cxd56.c b/src/portable/sony/cxd56/dcd_cxd56.c index f2a20accb..fbea03b1d 100644 --- a/src/portable/sony/cxd56/dcd_cxd56.c +++ b/src/portable/sony/cxd56/dcd_cxd56.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED && CFG_TUSB_MCU == OPT_MCU_CXD56 +#if CFG_TUD_ENABLED && CFG_TUSB_MCU == OPT_MCU_CXD56 #include #include diff --git a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c index 177a7ad2a..f201a02cf 100644 --- a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c +++ b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c @@ -109,7 +109,7 @@ #define STM32F1_FSDEV #endif -#if TUSB_OPT_DEVICE_ENABLED && \ +#if CFG_TUD_ENABLED && \ ( TU_CHECK_MCU(OPT_MCU_STM32F0, OPT_MCU_STM32F3, OPT_MCU_STM32L0, OPT_MCU_STM32L1, OPT_MCU_STM32G4) || \ (TU_CHECK_MCU(OPT_MCU_STM32F1) && defined(STM32F1_FSDEV)) \ ) diff --git a/src/portable/st/synopsys/dcd_synopsys.c b/src/portable/st/synopsys/dcd_synopsys.c index 4782ead8c..d7f659340 100644 --- a/src/portable/st/synopsys/dcd_synopsys.c +++ b/src/portable/st/synopsys/dcd_synopsys.c @@ -45,7 +45,7 @@ #define STM32L4_SYNOPSYS #endif -#if TUSB_OPT_DEVICE_ENABLED && \ +#if CFG_TUD_ENABLED && \ ( (CFG_TUSB_MCU == OPT_MCU_STM32F1 && defined(STM32F1_SYNOPSYS)) || \ CFG_TUSB_MCU == OPT_MCU_STM32F2 || \ CFG_TUSB_MCU == OPT_MCU_STM32F4 || \ diff --git a/src/portable/sunxi/dcd_sunxi_musb.c b/src/portable/sunxi/dcd_sunxi_musb.c index cf93c9bc4..447069f88 100644 --- a/src/portable/sunxi/dcd_sunxi_musb.c +++ b/src/portable/sunxi/dcd_sunxi_musb.c @@ -29,7 +29,7 @@ #include #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED && CFG_TUSB_MCU == OPT_MCU_F1C100S +#if CFG_TUD_ENABLED && CFG_TUSB_MCU == OPT_MCU_F1C100S #include "osal/osal.h" #include diff --git a/src/portable/synopsys/dwc2/dcd_dwc2.c b/src/portable/synopsys/dwc2/dcd_dwc2.c index 188611743..86dc760c8 100644 --- a/src/portable/synopsys/dwc2/dcd_dwc2.c +++ b/src/portable/synopsys/dwc2/dcd_dwc2.c @@ -30,7 +30,7 @@ #include "tusb_option.h" #include "device/dcd_attr.h" -#if TUSB_OPT_DEVICE_ENABLED && \ +#if CFG_TUD_ENABLED && \ ( defined(DCD_ATTR_DWC2_STM32) || \ TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3, OPT_MCU_GD32VF103) || \ TU_CHECK_MCU(OPT_MCU_EFM32GG, OPT_MCU_BCM2711, OPT_MCU_BCM2835) || \ diff --git a/src/portable/ti/msp430x5xx/dcd_msp430x5xx.c b/src/portable/ti/msp430x5xx/dcd_msp430x5xx.c index 3b91f2798..c3b3b2403 100644 --- a/src/portable/ti/msp430x5xx/dcd_msp430x5xx.c +++ b/src/portable/ti/msp430x5xx/dcd_msp430x5xx.c @@ -27,7 +27,7 @@ #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED && ( CFG_TUSB_MCU == OPT_MCU_MSP430x5xx ) +#if CFG_TUD_ENABLED && ( CFG_TUSB_MCU == OPT_MCU_MSP430x5xx ) #include "msp430.h" #include "device/dcd.h" diff --git a/src/portable/valentyusb/eptri/dcd_eptri.c b/src/portable/valentyusb/eptri/dcd_eptri.c index 51fb8b401..dfadfdcb3 100644 --- a/src/portable/valentyusb/eptri/dcd_eptri.c +++ b/src/portable/valentyusb/eptri/dcd_eptri.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if TUSB_OPT_DEVICE_ENABLED && (CFG_TUSB_MCU == OPT_MCU_VALENTYUSB_EPTRI) +#if CFG_TUD_ENABLED && (CFG_TUSB_MCU == OPT_MCU_VALENTYUSB_EPTRI) #ifndef DEBUG #define DEBUG 0 diff --git a/src/tusb.c b/src/tusb.c index 9583f509d..cad434a92 100644 --- a/src/tusb.c +++ b/src/tusb.c @@ -26,18 +26,18 @@ #include "tusb_option.h" -#if TUSB_OPT_HOST_ENABLED || TUSB_OPT_DEVICE_ENABLED +#if TUSB_OPT_HOST_ENABLED || CFG_TUD_ENABLED #include "tusb.h" // TODO clean up -#if TUSB_OPT_DEVICE_ENABLED +#if CFG_TUD_ENABLED #include "device/usbd_pvt.h" #endif bool tusb_init(void) { -#if TUSB_OPT_DEVICE_ENABLED +#if CFG_TUD_ENABLED TU_ASSERT ( tud_init(TUD_OPT_RHPORT) ); // init device stack #endif @@ -52,7 +52,7 @@ bool tusb_inited(void) { bool ret = false; -#if TUSB_OPT_DEVICE_ENABLED +#if CFG_TUD_ENABLED ret = ret || tud_inited(); #endif diff --git a/src/tusb.h b/src/tusb.h index 0d29e106c..2ffc1f681 100644 --- a/src/tusb.h +++ b/src/tusb.h @@ -61,7 +61,7 @@ #endif //------------- DEVICE -------------// -#if TUSB_OPT_DEVICE_ENABLED +#if CFG_TUD_ENABLED #include "device/usbd.h" #if CFG_TUD_HID diff --git a/src/tusb_option.h b/src/tusb_option.h index cb49c85ce..0e88c1507 100644 --- a/src/tusb_option.h +++ b/src/tusb_option.h @@ -215,7 +215,10 @@ #define TUD_OPT_HIGH_SPEED ( (CFG_TUSB_RHPORT1_MODE) & OPT_MODE_HIGH_SPEED ) #endif -#define TUSB_OPT_DEVICE_ENABLED ( TUD_OPT_RHPORT >= 0 ) +#define CFG_TUD_ENABLED ( TUD_OPT_RHPORT >= 0 ) + +// For backward compatible +#define TUSB_OPT_DEVICE_ENABLED CFG_TUD_ENABLED //--------------------------------------------------------------------+ // COMMON OPTIONS -- cgit v1.3.1 From 31aa077cb0b345464548b9cb2e2913227348a969 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 23 Feb 2022 21:49:11 +0700 Subject: rename TUSB_OPT_HOST_ENABLED to CFG_TUH_ENABLED --- hw/bsp/frdm_kl25z/frdm_kl25z.c | 2 +- hw/bsp/lpcxpresso1769/lpcxpresso1769.c | 2 +- hw/bsp/mbed1768/mbed1768.c | 2 +- hw/bsp/msp432e4/family.c | 6 +++--- hw/bsp/rp2040/family.c | 2 +- hw/bsp/rx/boards/rx65n_target/rx65n_target.c | 2 +- hw/bsp/tm4c123/family.c | 2 +- src/class/cdc/cdc_host.c | 2 +- src/class/cdc/cdc_rndis_host.c | 2 +- src/class/hid/hid_host.c | 2 +- src/class/msc/msc_host.c | 2 +- src/class/vendor/vendor_host.c | 2 +- src/host/hcd.h | 2 +- src/host/hub.c | 2 +- src/host/usbh.c | 2 +- src/host/usbh_control.c | 2 +- src/osal/osal_pico.h | 2 +- src/portable/chipidea/ci_hs/hcd_ci_hs.c | 2 +- src/portable/ehci/ehci.c | 2 +- src/portable/mentor/musb/hcd_musb.c | 2 +- src/portable/nxp/khci/hcd_khci.c | 2 +- src/portable/nxp/lpc17_40/hcd_lpc17_40.c | 2 +- src/portable/nxp/transdimension/hcd_transdimension.c | 2 +- src/portable/ohci/ohci.c | 2 +- src/portable/raspberrypi/rp2040/hcd_rp2040.c | 2 +- src/portable/raspberrypi/rp2040/rp2040_usb.c | 2 +- src/portable/raspberrypi/rp2040/rp2040_usb.h | 2 +- src/portable/renesas/usba/hcd_usba.c | 2 +- src/tusb.c | 6 +++--- src/tusb.h | 2 +- src/tusb_option.h | 17 ++++++++--------- 31 files changed, 42 insertions(+), 43 deletions(-) (limited to 'src/class') diff --git a/hw/bsp/frdm_kl25z/frdm_kl25z.c b/hw/bsp/frdm_kl25z/frdm_kl25z.c index 5f2a5b23d..8d93fdbaa 100644 --- a/hw/bsp/frdm_kl25z/frdm_kl25z.c +++ b/hw/bsp/frdm_kl25z/frdm_kl25z.c @@ -39,7 +39,7 @@ //--------------------------------------------------------------------+ void USB0_IRQHandler(void) { -#if TUSB_OPT_HOST_ENABLED +#if CFG_TUH_ENABLED tuh_int_handler(0); #endif #if CFG_TUD_ENABLED diff --git a/hw/bsp/lpcxpresso1769/lpcxpresso1769.c b/hw/bsp/lpcxpresso1769/lpcxpresso1769.c index e62544390..b82e5ffe0 100644 --- a/hw/bsp/lpcxpresso1769/lpcxpresso1769.c +++ b/hw/bsp/lpcxpresso1769/lpcxpresso1769.c @@ -161,7 +161,7 @@ void board_init(void) LPC_USB->OTGClkCtrl = clk_en; while ( (LPC_USB->OTGClkSt & clk_en) != clk_en ); -#if TUSB_OPT_HOST_ENABLED +#if CFG_TUH_ENABLED // set portfunc to host !!! LPC_USB->StCtrl = 0x3; // should be 1 #endif diff --git a/hw/bsp/mbed1768/mbed1768.c b/hw/bsp/mbed1768/mbed1768.c index 85dffde77..7c2b37016 100644 --- a/hw/bsp/mbed1768/mbed1768.c +++ b/hw/bsp/mbed1768/mbed1768.c @@ -135,7 +135,7 @@ void board_init(void) LPC_USB->OTGClkCtrl = clk_en; while ( (LPC_USB->OTGClkSt & clk_en) != clk_en ); -#if TUSB_OPT_HOST_ENABLED +#if CFG_TUH_ENABLED // set portfunc to host !!! LPC_USB->StCtrl = 0x3; // should be 1 #endif diff --git a/hw/bsp/msp432e4/family.c b/hw/bsp/msp432e4/family.c index d553b362e..3d2d4085e 100644 --- a/hw/bsp/msp432e4/family.c +++ b/hw/bsp/msp432e4/family.c @@ -33,7 +33,7 @@ //--------------------------------------------------------------------+ void USB0_IRQHandler(void) { -#if TUSB_OPT_HOST_ENABLED +#if CFG_TUH_ENABLED tuh_int_handler(0); #endif #if CFG_TUD_ENABLED @@ -123,7 +123,7 @@ void board_init(void) GPIOB->AMSEL = TU_BIT(0) | TU_BIT(1); GPIOL->AMSEL = TU_BIT(6) | TU_BIT(7); -#if TUSB_OPT_HOST_ENABLED +#if CFG_TUH_ENABLED /* USB PD6(EPEN) */ bits = TU_BIT(3); SYSCTL->RCGCGPIO |= bits; @@ -144,7 +144,7 @@ void board_init(void) USB0->CC = USB_CC_CLKEN | (3u << USB_CC_CLKDIV_S); /* 60MHz = 240MHz / 4 */ __DMB(); /* Wait for completion of opening of the clock gate */ -#if TUSB_OPT_HOST_ENABLED +#if CFG_TUH_ENABLED USB0->GPCS = USB_GPCS_DEVMOD_OTG; USB0->EPC = USB_EPC_EPENDE | USB_EPC_EPEN_HIGH; #endif diff --git a/hw/bsp/rp2040/family.c b/hw/bsp/rp2040/family.c index 6d0f7ed38..fa63dadf5 100644 --- a/hw/bsp/rp2040/family.c +++ b/hw/bsp/rp2040/family.c @@ -142,7 +142,7 @@ void board_init(void) #endif -#if TUSB_OPT_HOST_ENABLED +#if CFG_TUH_ENABLED // set portfunc to host !!! #endif } diff --git a/hw/bsp/rx/boards/rx65n_target/rx65n_target.c b/hw/bsp/rx/boards/rx65n_target/rx65n_target.c index 56bf575b2..f189e40e4 100644 --- a/hw/bsp/rx/boards/rx65n_target/rx65n_target.c +++ b/hw/bsp/rx/boards/rx65n_target/rx65n_target.c @@ -176,7 +176,7 @@ void INT_Excep_SCI5_RXI5(void) //--------------------------------------------------------------------+ void INT_Excep_USB0_USBI0(void) { -#if TUSB_OPT_HOST_ENABLED +#if CFG_TUH_ENABLED tuh_int_handler(0); #endif #if CFG_TUD_ENABLED diff --git a/hw/bsp/tm4c123/family.c b/hw/bsp/tm4c123/family.c index 1e19e7f43..b0947d6c4 100644 --- a/hw/bsp/tm4c123/family.c +++ b/hw/bsp/tm4c123/family.c @@ -7,7 +7,7 @@ //--------------------------------------------------------------------+ void USB0_Handler(void) { -#if TUSB_OPT_HOST_ENABLED +#if CFG_TUH_ENABLED tuh_int_handler(0); #endif diff --git a/src/class/cdc/cdc_host.c b/src/class/cdc/cdc_host.c index f4fb6c1d6..c18234db4 100644 --- a/src/class/cdc/cdc_host.c +++ b/src/class/cdc/cdc_host.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if (TUSB_OPT_HOST_ENABLED && CFG_TUH_CDC) +#if (CFG_TUH_ENABLED && CFG_TUH_CDC) #include "host/usbh.h" #include "host/usbh_classdriver.h" diff --git a/src/class/cdc/cdc_rndis_host.c b/src/class/cdc/cdc_rndis_host.c index d41cf91ac..8f28f51ac 100644 --- a/src/class/cdc/cdc_rndis_host.c +++ b/src/class/cdc/cdc_rndis_host.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if (TUSB_OPT_HOST_ENABLED && CFG_TUH_CDC && CFG_TUH_CDC_RNDIS) +#if (CFG_TUH_ENABLED && CFG_TUH_CDC && CFG_TUH_CDC_RNDIS) //--------------------------------------------------------------------+ // INCLUDE diff --git a/src/class/hid/hid_host.c b/src/class/hid/hid_host.c index f19f1ba81..542ed5772 100644 --- a/src/class/hid/hid_host.c +++ b/src/class/hid/hid_host.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if (TUSB_OPT_HOST_ENABLED && CFG_TUH_HID) +#if (CFG_TUH_ENABLED && CFG_TUH_HID) #include "host/usbh.h" #include "host/usbh_classdriver.h" diff --git a/src/class/msc/msc_host.c b/src/class/msc/msc_host.c index fa6519956..a49a10522 100644 --- a/src/class/msc/msc_host.c +++ b/src/class/msc/msc_host.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if TUSB_OPT_HOST_ENABLED & CFG_TUH_MSC +#if CFG_TUH_ENABLED & CFG_TUH_MSC #include "host/usbh.h" #include "host/usbh_classdriver.h" diff --git a/src/class/vendor/vendor_host.c b/src/class/vendor/vendor_host.c index 1e28e9af4..dbea1228d 100644 --- a/src/class/vendor/vendor_host.c +++ b/src/class/vendor/vendor_host.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if (TUSB_OPT_HOST_ENABLED && CFG_TUH_VENDOR) +#if (CFG_TUH_ENABLED && CFG_TUH_VENDOR) //--------------------------------------------------------------------+ // INCLUDE diff --git a/src/host/hcd.h b/src/host/hcd.h index eb53d2e80..054fd9647 100644 --- a/src/host/hcd.h +++ b/src/host/hcd.h @@ -82,7 +82,7 @@ typedef struct } hcd_event_t; -#if TUSB_OPT_HOST_ENABLED +#if CFG_TUH_ENABLED // Max number of endpoints per device enum { // TODO better computation diff --git a/src/host/hub.c b/src/host/hub.c index fd4dbd04a..53eb1d521 100644 --- a/src/host/hub.c +++ b/src/host/hub.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if (TUSB_OPT_HOST_ENABLED && CFG_TUH_HUB) +#if (CFG_TUH_ENABLED && CFG_TUH_HUB) #include "usbh.h" #include "usbh_classdriver.h" diff --git a/src/host/usbh.c b/src/host/usbh.c index 9854b75a3..e29ce1e54 100644 --- a/src/host/usbh.c +++ b/src/host/usbh.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if TUSB_OPT_HOST_ENABLED +#if CFG_TUH_ENABLED #include "tusb.h" #include "host/usbh.h" diff --git a/src/host/usbh_control.c b/src/host/usbh_control.c index 9204576ac..d034eec7f 100644 --- a/src/host/usbh_control.c +++ b/src/host/usbh_control.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if TUSB_OPT_HOST_ENABLED +#if CFG_TUH_ENABLED #include "tusb.h" #include "usbh_classdriver.h" diff --git a/src/osal/osal_pico.h b/src/osal/osal_pico.h index 4843d6450..70432d22b 100644 --- a/src/osal/osal_pico.h +++ b/src/osal/osal_pico.h @@ -100,7 +100,7 @@ static inline bool osal_mutex_unlock(osal_mutex_t mutex_hdl) //--------------------------------------------------------------------+ #include "common/tusb_fifo.h" -#if TUSB_OPT_HOST_ENABLED +#if CFG_TUH_ENABLED extern void hcd_int_disable(uint8_t rhport); extern void hcd_int_enable(uint8_t rhport); #endif diff --git a/src/portable/chipidea/ci_hs/hcd_ci_hs.c b/src/portable/chipidea/ci_hs/hcd_ci_hs.c index 3d028bf32..0754b477e 100644 --- a/src/portable/chipidea/ci_hs/hcd_ci_hs.c +++ b/src/portable/chipidea/ci_hs/hcd_ci_hs.c @@ -28,7 +28,7 @@ // Chipidea Highspeed USB IP implement EHCI for host functionality -#if TUSB_OPT_HOST_ENABLED && \ +#if CFG_TUH_ENABLED && \ (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX) //--------------------------------------------------------------------+ diff --git a/src/portable/ehci/ehci.c b/src/portable/ehci/ehci.c index e92f8a951..6b86cb2b2 100644 --- a/src/portable/ehci/ehci.c +++ b/src/portable/ehci/ehci.c @@ -26,7 +26,7 @@ #include "host/hcd_attr.h" -#if TUSB_OPT_HOST_ENABLED && defined(HCD_ATTR_EHCI_TRANSDIMENSION) +#if CFG_TUH_ENABLED && defined(HCD_ATTR_EHCI_TRANSDIMENSION) //--------------------------------------------------------------------+ // INCLUDE diff --git a/src/portable/mentor/musb/hcd_musb.c b/src/portable/mentor/musb/hcd_musb.c index acccb7674..3bfd65b45 100644 --- a/src/portable/mentor/musb/hcd_musb.c +++ b/src/portable/mentor/musb/hcd_musb.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if TUSB_OPT_HOST_ENABLED && \ +#if CFG_TUH_ENABLED && \ TU_CHECK_MCU(OPT_MCU_MSP432E4, OPT_MCU_TM4C123, OPT_MCU_TM4C129) #if __GNUC__ > 8 && defined(__ARM_FEATURE_UNALIGNED) diff --git a/src/portable/nxp/khci/hcd_khci.c b/src/portable/nxp/khci/hcd_khci.c index 92ec04d4a..fc0875cfe 100644 --- a/src/portable/nxp/khci/hcd_khci.c +++ b/src/portable/nxp/khci/hcd_khci.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if TUSB_OPT_HOST_ENABLED && ( \ +#if CFG_TUH_ENABLED && ( \ ( CFG_TUSB_MCU == OPT_MCU_MKL25ZXX ) || ( CFG_TUSB_MCU == OPT_MCU_K32L2BXX ) \ ) diff --git a/src/portable/nxp/lpc17_40/hcd_lpc17_40.c b/src/portable/nxp/lpc17_40/hcd_lpc17_40.c index 1c1faed94..ad9ed59b4 100644 --- a/src/portable/nxp/lpc17_40/hcd_lpc17_40.c +++ b/src/portable/nxp/lpc17_40/hcd_lpc17_40.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if TUSB_OPT_HOST_ENABLED && \ +#if CFG_TUH_ENABLED && \ (CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC40XX) #include "chip.h" diff --git a/src/portable/nxp/transdimension/hcd_transdimension.c b/src/portable/nxp/transdimension/hcd_transdimension.c index 81ad3152d..2d0830981 100644 --- a/src/portable/nxp/transdimension/hcd_transdimension.c +++ b/src/portable/nxp/transdimension/hcd_transdimension.c @@ -28,7 +28,7 @@ // NXP Trans-Dimension USB IP implement EHCI for host functionality -#if TUSB_OPT_HOST_ENABLED && \ +#if CFG_TUH_ENABLED && \ (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX) #warning "transdimenion is renamed to chipidea (portable/chipidea/ci_hs) to match other opensource naming convention such as linux. This file will be removed in the future, please update your makefile accordingly" diff --git a/src/portable/ohci/ohci.c b/src/portable/ohci/ohci.c index daa8075b7..8860f27a2 100644 --- a/src/portable/ohci/ohci.c +++ b/src/portable/ohci/ohci.c @@ -26,7 +26,7 @@ #include "host/hcd_attr.h" -#if TUSB_OPT_HOST_ENABLED && defined(HCD_ATTR_OHCI) +#if CFG_TUH_ENABLED && defined(HCD_ATTR_OHCI) //--------------------------------------------------------------------+ // INCLUDE diff --git a/src/portable/raspberrypi/rp2040/hcd_rp2040.c b/src/portable/raspberrypi/rp2040/hcd_rp2040.c index 3e80dd872..b6fbdb200 100644 --- a/src/portable/raspberrypi/rp2040/hcd_rp2040.c +++ b/src/portable/raspberrypi/rp2040/hcd_rp2040.c @@ -27,7 +27,7 @@ #include "tusb_option.h" -#if TUSB_OPT_HOST_ENABLED && CFG_TUSB_MCU == OPT_MCU_RP2040 +#if CFG_TUH_ENABLED && CFG_TUSB_MCU == OPT_MCU_RP2040 #include "pico.h" #include "rp2040_usb.h" diff --git a/src/portable/raspberrypi/rp2040/rp2040_usb.c b/src/portable/raspberrypi/rp2040/rp2040_usb.c index 9d833e65f..293cefaf6 100644 --- a/src/portable/raspberrypi/rp2040/rp2040_usb.c +++ b/src/portable/raspberrypi/rp2040/rp2040_usb.c @@ -87,7 +87,7 @@ void _hw_endpoint_buffer_control_update32(struct hw_endpoint *ep, uint32_t and_m *ep->buffer_control = value & ~USB_BUF_CTRL_AVAIL; // 12 cycle delay.. (should be good for 48*12Mhz = 576Mhz) // Don't need delay in host mode as host is in charge -#if !TUSB_OPT_HOST_ENABLED +#if !CFG_TUH_ENABLED __asm volatile ( "b 1f\n" "1: b 1f\n" diff --git a/src/portable/raspberrypi/rp2040/rp2040_usb.h b/src/portable/raspberrypi/rp2040/rp2040_usb.h index a9cf1dd07..da1933ddd 100644 --- a/src/portable/raspberrypi/rp2040/rp2040_usb.h +++ b/src/portable/raspberrypi/rp2040/rp2040_usb.h @@ -56,7 +56,7 @@ typedef struct hw_endpoint // Interrupt, bulk, etc uint8_t transfer_type; -#if TUSB_OPT_HOST_ENABLED +#if CFG_TUH_ENABLED // Only needed for host uint8_t dev_addr; diff --git a/src/portable/renesas/usba/hcd_usba.c b/src/portable/renesas/usba/hcd_usba.c index 35eb060cd..ebb682342 100644 --- a/src/portable/renesas/usba/hcd_usba.c +++ b/src/portable/renesas/usba/hcd_usba.c @@ -27,7 +27,7 @@ #include "tusb_option.h" -#if TUSB_OPT_HOST_ENABLED && ( CFG_TUSB_MCU == OPT_MCU_RX63X || \ +#if CFG_TUH_ENABLED && ( CFG_TUSB_MCU == OPT_MCU_RX63X || \ CFG_TUSB_MCU == OPT_MCU_RX65X || \ CFG_TUSB_MCU == OPT_MCU_RX72N ) #include "host/hcd.h" diff --git a/src/tusb.c b/src/tusb.c index cad434a92..03fe43104 100644 --- a/src/tusb.c +++ b/src/tusb.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if TUSB_OPT_HOST_ENABLED || CFG_TUD_ENABLED +#if CFG_TUH_ENABLED || CFG_TUD_ENABLED #include "tusb.h" @@ -41,7 +41,7 @@ bool tusb_init(void) TU_ASSERT ( tud_init(TUD_OPT_RHPORT) ); // init device stack #endif -#if TUSB_OPT_HOST_ENABLED +#if CFG_TUH_ENABLED TU_ASSERT( tuh_init(TUH_OPT_RHPORT) ); // init host stack #endif @@ -56,7 +56,7 @@ bool tusb_inited(void) ret = ret || tud_inited(); #endif -#if TUSB_OPT_HOST_ENABLED +#if CFG_TUH_ENABLED ret = ret || tuh_inited(); #endif diff --git a/src/tusb.h b/src/tusb.h index 2ffc1f681..549f00b43 100644 --- a/src/tusb.h +++ b/src/tusb.h @@ -39,7 +39,7 @@ #include "common/tusb_fifo.h" //------------- HOST -------------// -#if TUSB_OPT_HOST_ENABLED +#if CFG_TUH_ENABLED #include "host/usbh.h" #if CFG_TUH_HID diff --git a/src/tusb_option.h b/src/tusb_option.h index 0e88c1507..714c6ed9e 100644 --- a/src/tusb_option.h +++ b/src/tusb_option.h @@ -187,12 +187,10 @@ #define OPT_MODE_LOW_SPEED 0x10 ///< Max Low Speed #define OPT_MODE_HIGH_SPEED 0x20 ///< Max High Speed - #ifndef CFG_TUSB_RHPORT0_MODE #define CFG_TUSB_RHPORT0_MODE OPT_MODE_NONE #endif - #ifndef CFG_TUSB_RHPORT1_MODE #define CFG_TUSB_RHPORT1_MODE OPT_MODE_NONE #endif @@ -203,22 +201,23 @@ #endif // Which roothub port is configured as host -#define TUH_OPT_RHPORT ( ((CFG_TUSB_RHPORT0_MODE) & OPT_MODE_HOST) ? 0 : (((CFG_TUSB_RHPORT1_MODE) & OPT_MODE_HOST) ? 1 : -1) ) -#define TUSB_OPT_HOST_ENABLED ( TUH_OPT_RHPORT >= 0 ) +#define TUH_OPT_RHPORT ( ((CFG_TUSB_RHPORT0_MODE) & OPT_MODE_HOST) ? 0 : (((CFG_TUSB_RHPORT1_MODE) & OPT_MODE_HOST) ? 1 : -1) ) +#define CFG_TUH_ENABLED ( TUH_OPT_RHPORT >= 0 ) // Which roothub port is configured as device -#define TUD_OPT_RHPORT ( ((CFG_TUSB_RHPORT0_MODE) & OPT_MODE_DEVICE) ? 0 : (((CFG_TUSB_RHPORT1_MODE) & OPT_MODE_DEVICE) ? 1 : -1) ) +#define TUD_OPT_RHPORT ( ((CFG_TUSB_RHPORT0_MODE) & OPT_MODE_DEVICE) ? 0 : (((CFG_TUSB_RHPORT1_MODE) & OPT_MODE_DEVICE) ? 1 : -1) ) #if TUD_OPT_RHPORT == 0 -#define TUD_OPT_HIGH_SPEED ( (CFG_TUSB_RHPORT0_MODE) & OPT_MODE_HIGH_SPEED ) +#define TUD_OPT_HIGH_SPEED ( (CFG_TUSB_RHPORT0_MODE) & OPT_MODE_HIGH_SPEED ) #else -#define TUD_OPT_HIGH_SPEED ( (CFG_TUSB_RHPORT1_MODE) & OPT_MODE_HIGH_SPEED ) +#define TUD_OPT_HIGH_SPEED ( (CFG_TUSB_RHPORT1_MODE) & OPT_MODE_HIGH_SPEED ) #endif #define CFG_TUD_ENABLED ( TUD_OPT_RHPORT >= 0 ) // For backward compatible #define TUSB_OPT_DEVICE_ENABLED CFG_TUD_ENABLED +#define TUSB_OPT_HOST_ENABLED CFG_TUH_ENABLED //--------------------------------------------------------------------+ // COMMON OPTIONS @@ -316,7 +315,7 @@ //-------------------------------------------------------------------- // HOST OPTIONS //-------------------------------------------------------------------- -#if TUSB_OPT_HOST_ENABLED +#if CFG_TUH_ENABLED #ifndef CFG_TUH_DEVICE_MAX #define CFG_TUH_DEVICE_MAX 1 #endif @@ -324,7 +323,7 @@ #ifndef CFG_TUH_ENUMERATION_BUFSIZE #define CFG_TUH_ENUMERATION_BUFSIZE 256 #endif -#endif // TUSB_OPT_HOST_ENABLED +#endif // CFG_TUH_ENABLED //------------- CLASS -------------// -- cgit v1.3.1 From 309540473bc2985d83212b9da0527c7500ba2a66 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 25 Feb 2022 22:26:35 +0700 Subject: minor house keeping --- src/class/msc/msc_host.c | 2 +- src/common/tusb_error.h | 2 ++ src/device/usbd.c | 4 +--- src/host/usbh.c | 1 + src/tusb.c | 2 ++ src/tusb_option.h | 15 +++++++++++++-- 6 files changed, 20 insertions(+), 6 deletions(-) (limited to 'src/class') diff --git a/src/class/msc/msc_host.c b/src/class/msc/msc_host.c index a49a10522..e4239e375 100644 --- a/src/class/msc/msc_host.c +++ b/src/class/msc/msc_host.c @@ -26,7 +26,7 @@ #include "tusb_option.h" -#if CFG_TUH_ENABLED & CFG_TUH_MSC +#if CFG_TUH_ENABLED && CFG_TUH_MSC #include "host/usbh.h" #include "host/usbh_classdriver.h" diff --git a/src/common/tusb_error.h b/src/common/tusb_error.h index d7ad8c318..42541acd6 100644 --- a/src/common/tusb_error.h +++ b/src/common/tusb_error.h @@ -64,6 +64,8 @@ typedef enum #if CFG_TUSB_DEBUG /// Enum to String for debugging purposes. Only available if \ref CFG_TUSB_DEBUG > 0 extern char const* const tusb_strerr[TUSB_ERROR_COUNT]; +extern char const* const tusb_speed_str[]; + #endif #ifdef __cplusplus diff --git a/src/device/usbd.c b/src/device/usbd.c index e6861ee0a..c20bab76b 100644 --- a/src/device/usbd.c +++ b/src/device/usbd.c @@ -332,8 +332,6 @@ static char const* const _tusb_std_request_str[] = "Synch Frame" }; -static char const* const _tusb_speed_str[] = { "Full", "Low", "High" }; - // for usbd_control to print the name of control complete driver void usbd_driver_print_control_complete_name(usbd_control_xfer_cb_t callback) { @@ -509,7 +507,7 @@ void tud_task (void) switch ( event.event_id ) { case DCD_EVENT_BUS_RESET: - TU_LOG2(": %s Speed\r\n", _tusb_speed_str[event.bus_reset.speed]); + TU_LOG2(": %s Speed\r\n", tusb_speed_str[event.bus_reset.speed]); usbd_reset(event.rhport); _usbd_dev.speed = event.bus_reset.speed; break; diff --git a/src/host/usbh.c b/src/host/usbh.c index e29ce1e54..ce0ccc3cb 100644 --- a/src/host/usbh.c +++ b/src/host/usbh.c @@ -709,6 +709,7 @@ static bool enum_new_device(hcd_event_t* event) if ( !hcd_port_connect_status(_dev0.rhport) ) return true; _dev0.speed = hcd_port_speed_get(_dev0.rhport ); + TU_LOG2("%s Speed\r\n", tusb_speed_str[_dev0.speed]); enum_request_addr0_device_desc(); } diff --git a/src/tusb.c b/src/tusb.c index 03fe43104..a30221059 100644 --- a/src/tusb.c +++ b/src/tusb.c @@ -163,6 +163,8 @@ uint16_t tu_desc_get_interface_total_len(tusb_desc_interface_t const* desc_itf, char const* const tusb_strerr[TUSB_ERROR_COUNT] = { ERROR_TABLE(ERROR_STRING) }; +char const* const tusb_speed_str[] = { "Full", "Low", "High" }; + static void dump_str_line(uint8_t const* buf, uint16_t count) { tu_printf(" |"); diff --git a/src/tusb_option.h b/src/tusb_option.h index 6a3638461..5bf336438 100644 --- a/src/tusb_option.h +++ b/src/tusb_option.h @@ -223,8 +223,19 @@ // CFG_TUD_SPEED OPT_MODE_HIGH_SPEED //------------- Roothub as Host -------------// -#define TUH_OPT_RHPORT ( ((CFG_TUSB_RHPORT0_MODE) & OPT_MODE_HOST) ? 0 : (((CFG_TUSB_RHPORT1_MODE) & OPT_MODE_HOST) ? 1 : -1) ) -#define CFG_TUH_ENABLED ( TUH_OPT_RHPORT >= 0 ) + +#if (CFG_TUSB_RHPORT0_MODE) & OPT_MODE_HOST + #define TUH_RHPORT_MODE (CFG_TUSB_RHPORT0_MODE) + #define TUH_OPT_RHPORT 0 +#elif (CFG_TUSB_RHPORT1_MODE) & OPT_MODE_HOST + #define TUH_RHPORT_MODE (CFG_TUSB_RHPORT1_MODE) + #define TUH_OPT_RHPORT 1 +#else + #define TUH_RHPORT_MODE OPT_MODE_NONE + #define TUH_OPT_RHPORT -1 +#endif + +#define CFG_TUH_ENABLED ( TUH_RHPORT_MODE & OPT_MODE_HOST ) // For backward compatible #define TUSB_OPT_DEVICE_ENABLED CFG_TUD_ENABLED -- cgit v1.3.1