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>
This commit is contained in:
parent
48b60a8021
commit
18ff84aa04
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -247,7 +247,7 @@ usb_set_configure(void)
|
|||
}
|
||||
|
||||
void
|
||||
usb_request_bootloader(void)
|
||||
bootloader_request(void)
|
||||
{
|
||||
if (!CONFIG_SMOOTHIEWARE_BOOTLOADER)
|
||||
return;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
@ -36,6 +38,18 @@ watchdog_init(void)
|
|||
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
|
||||
****************************************************************/
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue