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-10-01 00:36:42 +0300
committerKevin O'Connor <kevin@koconnor.net>2022-10-06 04:53:23 +0300
commit834d9fcfb605b6d7a2c6fe5815d896470f9de8ba (patch)
treea55683ebf1e2285ccc53f033351bde60aa981a9b
parent993a420d474bf277902686da3ac643eb3ddddfa6 (diff)
atsamd: Move bootloader_request() from usbserial.c to main.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--src/atsamd/main.c18
-rw-r--r--src/atsamd/usbserial.c19
2 files changed, 19 insertions, 18 deletions
diff --git a/src/atsamd/main.c b/src/atsamd/main.c
index d3943e6ad..37b6cc8b2 100644
--- a/src/atsamd/main.c
+++ b/src/atsamd/main.c
@@ -5,9 +5,27 @@
// This file may be distributed under the terms of the GNU GPLv3 license.
#include "board/armcm_boot.h" // armcm_main
+#include "board/misc.h" // bootloader_request
+#include "board/io.h" // writel
+#include "board/irq.h" // irq_disable
#include "internal.h" // SystemInit
#include "sched.h" // sched_main
+void
+bootloader_request(void)
+{
+ if (!CONFIG_FLASH_START)
+ return;
+ // Bootloader hack
+ irq_disable();
+#if CONFIG_MACH_SAMD21
+ writel((void*)0x20007FFC, 0x07738135);
+#elif CONFIG_MACH_SAMX5
+ writel((void*)(HSRAM_ADDR + HSRAM_SIZE - 4), 0xf01669ef);
+#endif
+ NVIC_SystemReset();
+}
+
// Main entry point - called from armcm_boot.c:ResetHandler()
void
armcm_main(void)
diff --git a/src/atsamd/usbserial.c b/src/atsamd/usbserial.c
index bf3e0e802..938f8e211 100644
--- a/src/atsamd/usbserial.c
+++ b/src/atsamd/usbserial.c
@@ -7,9 +7,7 @@
#include <string.h> // memcpy
#include "autoconf.h" // CONFIG_FLASH_START
#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/io.h" // writeb
#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,21 +170,6 @@ usb_set_configure(void)
USB_DEVICE_EPINTENSET_TRCPT0 | USB_DEVICE_EPINTENSET_TRCPT1);
}
-void
-bootloader_request(void)
-{
- if (!CONFIG_FLASH_START)
- return;
- // Bootloader hack
- irq_disable();
-#if CONFIG_MACH_SAMD21
- writel((void*)0x20007FFC, 0x07738135);
-#elif CONFIG_MACH_SAMX5
- writel((void*)(HSRAM_ADDR + HSRAM_SIZE - 4), 0xf01669ef);
-#endif
- NVIC_SystemReset();
-}
-
/****************************************************************
* Setup and interrupts