mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-20 13:17:55 -06:00
stm32: Move irq handler code above irq setup
Only code movement. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
2a2cf1f536
commit
a44bc950a3
3 changed files with 88 additions and 88 deletions
|
@ -233,34 +233,6 @@ usb_request_bootloader(void)
|
|||
* Setup and interrupts
|
||||
****************************************************************/
|
||||
|
||||
DECL_CONSTANT_STR("RESERVE_PINS_USB", "PA11,PA12");
|
||||
|
||||
// Initialize the usb controller
|
||||
void
|
||||
usb_init(void)
|
||||
{
|
||||
// Pull the D+ pin low briefly to signal a new connection
|
||||
gpio_out_setup(GPIO('A', 12), 0);
|
||||
udelay(5000);
|
||||
gpio_in_setup(GPIO('A', 12), 0);
|
||||
|
||||
// Setup USB packet memory
|
||||
btable_configure();
|
||||
|
||||
// Enable USB clock
|
||||
enable_pclock(USB_BASE);
|
||||
|
||||
// Reset usb controller and enable interrupts
|
||||
USB->CNTR = USB_CNTR_FRES;
|
||||
USB->BTABLE = 0;
|
||||
USB->DADDR = 0;
|
||||
USB->CNTR = USB_CNTR_RESETM;
|
||||
USB->ISTR = 0;
|
||||
NVIC_SetPriority(USB_LP_CAN1_RX0_IRQn, 1);
|
||||
NVIC_EnableIRQ(USB_LP_CAN1_RX0_IRQn);
|
||||
}
|
||||
DECL_INIT(usb_init);
|
||||
|
||||
// Configure interface after a USB reset event
|
||||
static void
|
||||
usb_reset(void)
|
||||
|
@ -305,3 +277,31 @@ USB_LP_CAN1_RX0_IRQHandler(void)
|
|||
usb_reset();
|
||||
}
|
||||
}
|
||||
|
||||
DECL_CONSTANT_STR("RESERVE_PINS_USB", "PA11,PA12");
|
||||
|
||||
// Initialize the usb controller
|
||||
void
|
||||
usb_init(void)
|
||||
{
|
||||
// Pull the D+ pin low briefly to signal a new connection
|
||||
gpio_out_setup(GPIO('A', 12), 0);
|
||||
udelay(5000);
|
||||
gpio_in_setup(GPIO('A', 12), 0);
|
||||
|
||||
// Setup USB packet memory
|
||||
btable_configure();
|
||||
|
||||
// Enable USB clock
|
||||
enable_pclock(USB_BASE);
|
||||
|
||||
// Reset usb controller and enable interrupts
|
||||
USB->CNTR = USB_CNTR_FRES;
|
||||
USB->BTABLE = 0;
|
||||
USB->DADDR = 0;
|
||||
USB->CNTR = USB_CNTR_RESETM;
|
||||
USB->ISTR = 0;
|
||||
NVIC_SetPriority(USB_LP_CAN1_RX0_IRQn, 1);
|
||||
NVIC_EnableIRQ(USB_LP_CAN1_RX0_IRQn);
|
||||
}
|
||||
DECL_INIT(usb_init);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue