mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-06 15:01:36 +08:00
Fix infinite loop in CDC/ACM driver
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4655 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
@@ -1870,6 +1870,7 @@ static void stm32_usbreset(struct stm32_usbdev_s *priv)
|
||||
|
||||
privep->stalled = false;
|
||||
}
|
||||
|
||||
stm32_putreg(0xffffffff, STM32_OTGFS_DAINT);
|
||||
|
||||
/* Mask all device endpoint interrupts except EP0 */
|
||||
@@ -5283,6 +5284,7 @@ int usbdev_unregister(struct usbdevclass_driver_s *driver)
|
||||
*/
|
||||
|
||||
FAR struct stm32_usbdev_s *priv = &g_otgfsdev;
|
||||
irqstate_t flags;
|
||||
|
||||
usbtrace(TRACE_DEVUNREGISTER, 0);
|
||||
|
||||
@@ -5294,6 +5296,13 @@ int usbdev_unregister(struct usbdevclass_driver_s *driver)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Reset the hardware and cancel all requests. All requests must be
|
||||
* canceled while the class driver is still bound.
|
||||
*/
|
||||
|
||||
flags = irqsave();
|
||||
stm32_usbreset(priv);
|
||||
|
||||
/* Unbind the class driver */
|
||||
|
||||
CLASS_UNBIND(driver, &priv->usbdev);
|
||||
@@ -5302,9 +5311,15 @@ int usbdev_unregister(struct usbdevclass_driver_s *driver)
|
||||
|
||||
up_disable_irq(STM32_IRQ_OTGFS);
|
||||
|
||||
/* Disconnect device */
|
||||
|
||||
stm32_pullup(&priv->usbdev, false);
|
||||
|
||||
/* Unhook the driver */
|
||||
|
||||
priv->driver = NULL;
|
||||
irqrestore(flags);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user