From 9768316cd360db334dce307e1a8fefd081785401 Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Sat, 16 Nov 2019 11:11:54 +0100 Subject: [PATCH] common: Disable the USB interrupt in usb_serial::shutdown(). --- src/common/usb_serial.rs | 9 +++++++++ src/common/virtual_com.c | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/common/usb_serial.rs b/src/common/usb_serial.rs index cce12e3..3f9e48f 100644 --- a/src/common/usb_serial.rs +++ b/src/common/usb_serial.rs @@ -48,6 +48,15 @@ pub unsafe extern fn USB_DeviceIsrEnable() nvic::enable_irq(irq_number); } +#[no_mangle] +#[allow(non_snake_case)] +pub unsafe extern fn USB_DeviceIsrDisable() +{ + let irq_number = 24; // USB0 + + nvic::disable_irq(irq_number); +} + #[no_mangle] #[allow(non_snake_case)] pub unsafe extern fn USB_DeviceClockInit() diff --git a/src/common/virtual_com.c b/src/common/virtual_com.c index 2427f93..cc388c7 100644 --- a/src/common/virtual_com.c +++ b/src/common/virtual_com.c @@ -59,6 +59,7 @@ /* Provided by users. */ extern void USB_DeviceClockInit(void); extern void USB_DeviceIsrEnable(void); +extern void USB_DeviceIsrDisable(void); /******************************************************************************* * Definitions ******************************************************************************/ @@ -669,6 +670,8 @@ USB_VcomDeinit (void) USB_DeviceDeinit (s_cdcVcom.deviceHandle); s_cdcVcom.deviceHandle = NULL; + USB_DeviceIsrDisable(); + /* XXX: We are not stopping the USBOTG clock yet. */ } -- 2.30.2