Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Klipper3d/klipper.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2022-07-25 20:17:23 +0300
committerKevin O'Connor <kevin@koconnor.net>2022-07-29 18:40:54 +0300
commit18ff84aa04c3dbf39166d4bad210e91a9381960f (patch)
tree543ed2f14b4176a4ce7e8507cc3a2371dcc64b65
parent48b60a8021bd02d998fd3d6ea9e55645e3dc75e4 (diff)
usb_cdc: Rename usb_request_bootloader() to bootloader_request()
Rename this board API function to a more generic name. This is in preparation for calling the function from the canbus code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--src/atsam/main.c4
-rw-r--r--src/atsamd/usbserial.c3
-rw-r--r--src/avr/usbserial.c3
-rw-r--r--src/generic/misc.h2
-rw-r--r--src/generic/usb_cdc.c2
-rw-r--r--src/generic/usb_cdc.h1
-rw-r--r--src/lpc176x/usbserial.c2
-rw-r--r--src/rp2040/main.c14
-rw-r--r--src/rp2040/usbserial.c7
-rw-r--r--src/stm32/stm32f0.c7
-rw-r--r--src/stm32/stm32f1.c10
-rw-r--r--src/stm32/stm32f4.c8
-rw-r--r--src/stm32/stm32g0.c5
-rw-r--r--src/stm32/stm32h7.c9
14 files changed, 45 insertions, 32 deletions
diff --git a/src/atsam/main.c b/src/atsam/main.c
index 5a19d5293..8c2e4318d 100644
--- a/src/atsam/main.c
+++ b/src/atsam/main.c
@@ -6,7 +6,7 @@
#include "board/armcm_boot.h" // armcm_main
#include "board/irq.h" // irq_disable
-#include "board/usb_cdc.h" // usb_request_bootloader
+#include "board/misc.h" // bootloader_request
#include "command.h" // DECL_COMMAND_FLAGS
#include "internal.h" // WDT
#include "sched.h" // sched_main
@@ -94,7 +94,7 @@ DECL_COMMAND_FLAGS(command_reset, HF_IN_SHUTDOWN, "reset");
#endif
void noinline __aligned(16) // align for predictable flash code access
-usb_request_bootloader(void)
+bootloader_request(void)
{
irq_disable();
// Request boot from ROM (instead of boot from flash)
diff --git a/src/atsamd/usbserial.c b/src/atsamd/usbserial.c
index e3848926e..531c7dae2 100644
--- a/src/atsamd/usbserial.c
+++ b/src/atsamd/usbserial.c
@@ -9,6 +9,7 @@
#include "board/armcm_boot.h" // armcm_enable_irq
#include "board/io.h" // readl
#include "board/irq.h" // irq_disable
+#include "board/misc.h" // bootloader_request
#include "board/usb_cdc.h" // usb_notify_ep0
#include "board/usb_cdc_ep.h" // USB_CDC_EP_BULK_IN
#include "command.h" // DECL_CONSTANT_STR
@@ -172,7 +173,7 @@ usb_set_configure(void)
}
void
-usb_request_bootloader(void)
+bootloader_request(void)
{
if (!CONFIG_FLASH_START)
return;
diff --git a/src/avr/usbserial.c b/src/avr/usbserial.c
index 442ef934a..ab61fde22 100644
--- a/src/avr/usbserial.c
+++ b/src/avr/usbserial.c
@@ -7,6 +7,7 @@
#include <avr/interrupt.h> // USB_COM_vect
#include <string.h> // NULL
#include "autoconf.h" // CONFIG_MACH_at90usb1286
+#include "board/misc.h" // bootloader_request
#include "board/usb_cdc.h" // usb_notify_ep0
#include "board/usb_cdc_ep.h" // USB_CDC_EP_BULK_IN
#include "pgm.h" // READP
@@ -179,7 +180,7 @@ usb_set_configure(void)
}
void
-usb_request_bootloader(void)
+bootloader_request(void)
{
}
diff --git a/src/generic/misc.h b/src/generic/misc.h
index a24e8b0a4..fe0804e48 100644
--- a/src/generic/misc.h
+++ b/src/generic/misc.h
@@ -18,4 +18,6 @@ void *dynmem_end(void);
uint16_t crc16_ccitt(uint8_t *buf, uint_fast8_t len);
+void bootloader_request(void);
+
#endif // misc.h
diff --git a/src/generic/usb_cdc.c b/src/generic/usb_cdc.c
index 3a033cc92..40ff74ba6 100644
--- a/src/generic/usb_cdc.c
+++ b/src/generic/usb_cdc.c
@@ -448,7 +448,7 @@ check_reboot(void)
{
if (line_coding.dwDTERate == 1200 && !(line_control_state & 0x01))
// A baud of 1200 is an Arduino style request to enter the bootloader
- usb_request_bootloader();
+ bootloader_request();
}
static void
diff --git a/src/generic/usb_cdc.h b/src/generic/usb_cdc.h
index f955c840e..3c92ef13f 100644
--- a/src/generic/usb_cdc.h
+++ b/src/generic/usb_cdc.h
@@ -21,7 +21,6 @@ int_fast8_t usb_send_ep0_progmem(const void *data, uint_fast8_t len);
void usb_stall_ep0(void);
void usb_set_address(uint_fast8_t addr);
void usb_set_configure(void);
-void usb_request_bootloader(void);
struct usb_string_descriptor *usbserial_get_serialid(void);
// usb_cdc.c
diff --git a/src/lpc176x/usbserial.c b/src/lpc176x/usbserial.c
index bbb90438e..af7d66b5f 100644
--- a/src/lpc176x/usbserial.c
+++ b/src/lpc176x/usbserial.c
@@ -247,7 +247,7 @@ usb_set_configure(void)
}
void
-usb_request_bootloader(void)
+bootloader_request(void)
{
if (!CONFIG_SMOOTHIEWARE_BOOTLOADER)
return;
diff --git a/src/rp2040/main.c b/src/rp2040/main.c
index fbbe3b56d..462e69c69 100644
--- a/src/rp2040/main.c
+++ b/src/rp2040/main.c
@@ -5,11 +5,13 @@
// This file may be distributed under the terms of the GNU GPLv3 license.
#include <stdint.h> // uint32_t
+#include "board/misc.h" // bootloader_request
#include "hardware/structs/clocks.h" // clock_hw_t
#include "hardware/structs/pll.h" // pll_hw_t
#include "hardware/structs/resets.h" // sio_hw
#include "hardware/structs/watchdog.h" // watchdog_hw
#include "hardware/structs/xosc.h" // xosc_hw
+#include "internal.h" // enable_pclock
#include "sched.h" // sched_main
@@ -37,6 +39,18 @@ DECL_INIT(watchdog_init);
/****************************************************************
+ * Bootloader
+ ****************************************************************/
+
+void
+bootloader_request(void)
+{
+ // Use the bootrom-provided code to reset into BOOTSEL mode
+ reset_to_usb_boot(0, 0);
+}
+
+
+/****************************************************************
* Clock setup
****************************************************************/
diff --git a/src/rp2040/usbserial.c b/src/rp2040/usbserial.c
index 83838d2d5..aafe53ef8 100644
--- a/src/rp2040/usbserial.c
+++ b/src/rp2040/usbserial.c
@@ -160,13 +160,6 @@ usb_set_configure(void)
USB_BUF_CTRL_AVAIL | USB_BUF_CTRL_LAST | DPBUF_SIZE);
}
-void
-usb_request_bootloader(void)
-{
- // Use the bootrom-provided code to reset into BOOTSEL mode
- reset_to_usb_boot(0, 0);
-}
-
/****************************************************************
* USB Errata workaround
diff --git a/src/stm32/stm32f0.c b/src/stm32/stm32f0.c
index 8ea8f43c8..98933b9dd 100644
--- a/src/stm32/stm32f0.c
+++ b/src/stm32/stm32f0.c
@@ -8,6 +8,7 @@
#include "board/armcm_boot.h" // armcm_main
#include "board/armcm_reset.h" // try_request_canboot
#include "board/irq.h" // irq_disable
+#include "board/misc.h" // bootloader_request
#include "command.h" // DECL_CONSTANT_STR
#include "internal.h" // enable_pclock
#include "sched.h" // sched_main
@@ -130,7 +131,7 @@ hsi14_setup(void)
/****************************************************************
- * USB bootloader
+ * Bootloader
****************************************************************/
#define USB_BOOT_FLAG_ADDR (CONFIG_RAM_START + CONFIG_RAM_SIZE - 1024)
@@ -160,9 +161,9 @@ check_usb_dfu_bootloader(void)
: : "r"(sysbase[0]), "r"(sysbase[1]));
}
-// Handle USB reboot requests
+// Handle reboot requests
void
-usb_request_bootloader(void)
+bootloader_request(void)
{
try_request_canboot();
usb_reboot_for_dfu_bootloader();
diff --git a/src/stm32/stm32f1.c b/src/stm32/stm32f1.c
index 820a55184..9d3c3b975 100644
--- a/src/stm32/stm32f1.c
+++ b/src/stm32/stm32f1.c
@@ -1,6 +1,6 @@
// Code to setup clocks and gpio on stm32f1
//
-// Copyright (C) 2019-2021 Kevin O'Connor <kevin@koconnor.net>
+// Copyright (C) 2019-2022 Kevin O'Connor <kevin@koconnor.net>
//
// This file may be distributed under the terms of the GNU GPLv3 license.
@@ -8,7 +8,7 @@
#include "board/armcm_boot.h" // VectorTable
#include "board/armcm_reset.h" // try_request_canboot
#include "board/irq.h" // irq_disable
-#include "board/usb_cdc.h" // usb_request_bootloader
+#include "board/misc.h" // bootloader_request
#include "internal.h" // enable_pclock
#include "sched.h" // sched_main
@@ -213,7 +213,7 @@ gpio_peripheral(uint32_t gpio, uint32_t mode, int pullup)
/****************************************************************
- * USB bootloader
+ * Bootloader
****************************************************************/
// Reboot into USB "HID" bootloader
@@ -240,9 +240,9 @@ usb_stm32duino_bootloader(void)
NVIC_SystemReset();
}
-// Handle USB reboot requests
+// Handle reboot requests
void
-usb_request_bootloader(void)
+bootloader_request(void)
{
try_request_canboot();
if (CONFIG_STM32_FLASH_START_800)
diff --git a/src/stm32/stm32f4.c b/src/stm32/stm32f4.c
index 9c6880cfd..0b032de73 100644
--- a/src/stm32/stm32f4.c
+++ b/src/stm32/stm32f4.c
@@ -8,7 +8,7 @@
#include "board/armcm_boot.h" // VectorTable
#include "board/armcm_reset.h" // try_request_canboot
#include "board/irq.h" // irq_disable
-#include "board/usb_cdc.h" // usb_request_bootloader
+#include "board/misc.h" // bootloader_request
#include "command.h" // DECL_CONSTANT_STR
#include "internal.h" // enable_pclock
#include "sched.h" // sched_main
@@ -188,7 +188,7 @@ clock_setup(void)
/****************************************************************
- * USB bootloader
+ * Bootloader
****************************************************************/
// Reboot into USB "HID" bootloader
@@ -228,9 +228,9 @@ check_usb_dfu_bootloader(void)
: : "r"(sysbase[0]), "r"(sysbase[1]));
}
-// Handle USB reboot requests
+// Handle reboot requests
void
-usb_request_bootloader(void)
+bootloader_request(void)
{
try_request_canboot();
if (CONFIG_STM32_FLASH_START_4000)
diff --git a/src/stm32/stm32g0.c b/src/stm32/stm32g0.c
index 36520dfbf..36191ebf7 100644
--- a/src/stm32/stm32g0.c
+++ b/src/stm32/stm32g0.c
@@ -8,6 +8,7 @@
#include "board/armcm_boot.h" // armcm_main
#include "board/armcm_reset.h" // try_request_canboot
#include "board/irq.h" // irq_disable
+#include "board/misc.h" // bootloader_request
#include "command.h" // DECL_CONSTANT_STR
#include "internal.h" // enable_pclock
#include "sched.h" // sched_main
@@ -103,7 +104,7 @@ clock_setup(void)
/****************************************************************
- * USB bootloader
+ * Bootloader
****************************************************************/
#define USB_BOOT_FLAG_ADDR (CONFIG_RAM_START + CONFIG_RAM_SIZE - 1024)
@@ -132,7 +133,7 @@ check_usb_dfu_bootloader(void)
// Handle USB reboot requests
void
-usb_request_bootloader(void)
+bootloader_request(void)
{
try_request_canboot();
usb_reboot_for_dfu_bootloader();
diff --git a/src/stm32/stm32h7.c b/src/stm32/stm32h7.c
index bb0fe4543..565353dc2 100644
--- a/src/stm32/stm32h7.c
+++ b/src/stm32/stm32h7.c
@@ -6,8 +6,9 @@
#include "autoconf.h" // CONFIG_CLOCK_REF_FREQ
#include "board/armcm_boot.h" // VectorTable
-#include "board/irq.h" // irq_disable
#include "board/armcm_reset.h" // try_request_canboot
+#include "board/irq.h" // irq_disable
+#include "board/misc.h" // bootloader_request
#include "command.h" // DECL_CONSTANT_STR
#include "internal.h" // get_pclock_frequency
#include "sched.h" // sched_main
@@ -185,7 +186,7 @@ clock_setup(void)
/****************************************************************
- * USB bootloader
+ * Bootloader
****************************************************************/
#define USB_BOOT_FLAG_ADDR (CONFIG_RAM_START + CONFIG_RAM_SIZE - 1024)
@@ -212,9 +213,9 @@ check_usb_dfu_bootloader(void)
: : "r"(sysbase[0]), "r"(sysbase[1]));
}
-// Handle USB reboot requests
+// Handle reboot requests
void
-usb_request_bootloader(void)
+bootloader_request(void)
{
try_request_canboot();
usb_reboot_for_dfu_bootloader();