common: Disable the USB interrupt in usb_serial::shutdown().
authorTilman Sauerbeck <tilman@code-monkey.de>
Sat, 16 Nov 2019 10:11:54 +0000 (11:11 +0100)
committerTilman Sauerbeck <tilman@code-monkey.de>
Sun, 5 Jan 2020 19:38:11 +0000 (20:38 +0100)
src/common/usb_serial.rs
src/common/virtual_com.c

index cce12e3da405d160287eb8f460ebdd0c4010d2e1..3f9e48f7faff8a81e244e477744dad5e0fce5c68 100644 (file)
@@ -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()
index 2427f9369564239c6fc83dbb0b0ebb30faba46ff..cc388c704778aa037805d3fb01ffd56428a7f6e9 100644 (file)
@@ -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. */
 }