rename TUSB_OPT_DEVICE_ENABLED to CFG_TUD_ENABLED

TUSB_OPT_DEVICE_ENABLED still usable for backward compatible
This commit is contained in:
hathach
2022-02-23 21:46:40 +07:00
parent 4a5a53b3b8
commit d10326cb4e
59 changed files with 70 additions and 67 deletions

View File

@@ -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

View File

@@ -30,7 +30,7 @@
#include <registers/ft900_registers.h>
#include <ft900.h>
#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);

View File

@@ -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

View File

@@ -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);

View File

@@ -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;

View File

@@ -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
}

View File

@@ -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 );

View File

@@ -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 );

View File

@@ -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
}

View File

@@ -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);

View File

@@ -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

View File

@@ -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
}

View File

@@ -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

View File

@@ -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
}