atsamd: Move bootloader_request() from usbserial.c to main.c

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2022-09-30 17:36:42 -04:00
parent bdf79caac4
commit 0a9becc391
2 changed files with 19 additions and 18 deletions

View File

@ -5,9 +5,27 @@
// This file may be distributed under the terms of the GNU GPLv3 license. // This file may be distributed under the terms of the GNU GPLv3 license.
#include "board/armcm_boot.h" // armcm_main #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 "internal.h" // SystemInit
#include "sched.h" // sched_main #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() // Main entry point - called from armcm_boot.c:ResetHandler()
void void
armcm_main(void) armcm_main(void)

View File

@ -7,9 +7,7 @@
#include <string.h> // memcpy #include <string.h> // memcpy
#include "autoconf.h" // CONFIG_FLASH_START #include "autoconf.h" // CONFIG_FLASH_START
#include "board/armcm_boot.h" // armcm_enable_irq #include "board/armcm_boot.h" // armcm_enable_irq
#include "board/io.h" // readl #include "board/io.h" // writeb
#include "board/irq.h" // irq_disable
#include "board/misc.h" // bootloader_request
#include "board/usb_cdc.h" // usb_notify_ep0 #include "board/usb_cdc.h" // usb_notify_ep0
#include "board/usb_cdc_ep.h" // USB_CDC_EP_BULK_IN #include "board/usb_cdc_ep.h" // USB_CDC_EP_BULK_IN
#include "command.h" // DECL_CONSTANT_STR #include "command.h" // DECL_CONSTANT_STR
@ -172,21 +170,6 @@ usb_set_configure(void)
USB_DEVICE_EPINTENSET_TRCPT0 | USB_DEVICE_EPINTENSET_TRCPT1); 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 * Setup and interrupts