Change rom_reset_usb_boot to simply call rom_reset_usb_boot_extra

(in order to reduce code-duplication)
This commit is contained in:
Andrew Scheller 2025-08-09 12:57:41 +01:00 committed by GitHub
parent 1ca77d6afd
commit 974f70c744
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -33,21 +33,8 @@ bool rom_funcs_lookup(uint32_t *table, unsigned int count) {
void __attribute__((noreturn)) rom_reset_usb_boot(uint32_t usb_activity_gpio_pin_mask, uint32_t disable_interface_mask) { void __attribute__((noreturn)) rom_reset_usb_boot(uint32_t usb_activity_gpio_pin_mask, uint32_t disable_interface_mask) {
#ifdef ROM_FUNC_RESET_USB_BOOT int usb_activity_gpio_pin = usb_activity_gpio_pin_mask ? __builtin_ctz(usb_activity_gpio_pin_mask) : -1;
rom_reset_usb_boot_fn func = (rom_reset_usb_boot_fn) rom_func_lookup(ROM_FUNC_RESET_USB_BOOT); rom_reset_usb_boot_extra(usb_activity_gpio_pin, disable_interface_mask, false);
func(usb_activity_gpio_pin_mask, disable_interface_mask);
#elif defined(ROM_FUNC_REBOOT)
uint32_t flags = disable_interface_mask;
if (usb_activity_gpio_pin_mask) {
flags |= BOOTSEL_FLAG_GPIO_PIN_SPECIFIED;
// the parameter is actually the gpio number, but we only care if BOOTSEL_FLAG_GPIO_PIN_SPECIFIED
usb_activity_gpio_pin_mask = (uint32_t)__builtin_ctz(usb_activity_gpio_pin_mask);
}
rom_reboot(REBOOT2_FLAG_REBOOT_TYPE_BOOTSEL | REBOOT2_FLAG_NO_RETURN_ON_SUCCESS, 10, flags, usb_activity_gpio_pin_mask);
__builtin_unreachable();
#else
panic_unsupported();
#endif
} }
void __attribute__((noreturn)) rom_reset_usb_boot_extra(int usb_activity_gpio_pin, uint32_t disable_interface_mask, bool usb_activity_gpio_pin_active_low) { void __attribute__((noreturn)) rom_reset_usb_boot_extra(int usb_activity_gpio_pin, uint32_t disable_interface_mask, bool usb_activity_gpio_pin_active_low) {