aboutsummaryrefslogtreecommitdiffstats
path: root/src/lpc176x/usbserial.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2022-09-01 21:27:05 -0400
committerKevin O'Connor <kevin@koconnor.net>2022-09-05 14:27:25 -0400
commitba38897a357b285f05cc3444227345a47b97590d (patch)
treea9e2160db605dbabdec7fec2461acd36a60fac78 /src/lpc176x/usbserial.c
parentf6a166cb67c2f11cc5cf3ab7399bdff4274a29c1 (diff)
downloadkutter-ba38897a357b285f05cc3444227345a47b97590d.tar.gz
kutter-ba38897a357b285f05cc3444227345a47b97590d.tar.xz
kutter-ba38897a357b285f05cc3444227345a47b97590d.zip
lpc176x: Move bootloader_request() from usbserial.c to main.c
Move bootloader_request() function so that it can be used when not using USB. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/lpc176x/usbserial.c')
-rw-r--r--src/lpc176x/usbserial.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/lpc176x/usbserial.c b/src/lpc176x/usbserial.c
index af7d66b5..858475eb 100644
--- a/src/lpc176x/usbserial.c
+++ b/src/lpc176x/usbserial.c
@@ -8,8 +8,6 @@
#include "autoconf.h" // CONFIG_SMOOTHIEWARE_BOOTLOADER
#include "board/armcm_boot.h" // armcm_enable_irq
#include "board/armcm_timer.h" // udelay
-#include "board/armcm_reset.h" // try_request_canboot
-#include "board/irq.h" // irq_disable
#include "board/misc.h" // timer_read_time
#include "byteorder.h" // cpu_to_le32
#include "command.h" // DECL_CONSTANT_STR
@@ -246,20 +244,12 @@ usb_set_configure(void)
usb_irq_enable();
}
+// Force a USB disconnect (used during reboot into bootloader)
void
-bootloader_request(void)
+usb_disconnect(void)
{
- if (!CONFIG_SMOOTHIEWARE_BOOTLOADER)
- return;
- try_request_canboot();
- // Disable USB and pause for 5ms so host recognizes a disconnect
- irq_disable();
sie_cmd_write(SIE_CMD_SET_DEVICE_STATUS, 0);
udelay(5000);
- // The "LPC17xx-DFU-Bootloader" will enter the bootloader if the
- // watchdog timeout flag is set.
- LPC_WDT->WDMOD = 0x07;
- NVIC_SystemReset();
}