From c3150eb13679314f8bfc02714ae0027dd1658002 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Thu, 16 Jun 2016 09:22:22 +0000 Subject: USB fixes. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9628 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/AVR/RT-ARDUINOLEONARDO/usbcfg.c | 8 +++ demos/AVR/RT-PRO_MICRO/usbcfg.c | 8 +++ demos/AVR/RT-TEENSY2-USB/usbcfg.c | 8 +++ demos/STM32/RT-STM32F103-MAPLEMINI/usbcfg.c | 2 + .../RT-STM32F103-STM3210E_EVAL-FATFS-USB/usbcfg.c | 2 + demos/STM32/RT-STM32F103_INEMO_DISCOVERY/usbcfg.c | 2 + .../usbcfg.c | 2 + demos/STM32/RT-STM32F429-DISCOVERY/usbcfg.c | 2 + .../usbcfg.c | 2 + demos/STM32/RT-STM32L053-DISCOVERY/usbcfg.c | 2 + os/hal/include/hal_usb.h | 7 ++- os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h | 4 ++ os/hal/src/hal_serial_usb.c | 67 +++++++++++----------- os/hal/src/hal_usb.c | 31 ++++++---- testhal/STM32/STM32F0xx/USB_CDC/usbcfg.c | 2 + testhal/STM32/STM32F1xx/USB_CDC/usbcfg.c | 2 + testhal/STM32/STM32F2xx/USB_CDC/usbcfg.c | 2 + testhal/STM32/STM32F37x/USB_CDC/usbcfg.c | 2 + testhal/STM32/STM32F3xx/I2C-LSM303DLHC/usbcfg.c | 2 + testhal/STM32/STM32F3xx/SPI-L3GD20/usbcfg.c | 2 + testhal/STM32/STM32F3xx/USB_CDC/usbcfg.c | 2 + testhal/STM32/STM32F3xx/USB_CDC_IAD/usbcfg.c | 2 + testhal/STM32/STM32F4xx/I2C-LSM303DLHC/usbcfg.c | 2 + testhal/STM32/STM32F4xx/SPI-L3GD20/usbcfg.c | 2 + testhal/STM32/STM32F4xx/SPI-LIS302DL/usbcfg.c | 2 + testhal/STM32/STM32F4xx/SPI-LIS3DSH/usbcfg.c | 2 + testhal/STM32/STM32F4xx/USB_CDC/usbcfg.c | 2 + testhal/STM32/STM32F4xx/USB_CDC_IAD/usbcfg.c | 2 + testhal/STM32/STM32F7xx/USB_CDC/usbcfg.c | 2 + testhal/STM32/STM32F7xx/USB_RAW/usbcfg.c | 2 + 30 files changed, 131 insertions(+), 48 deletions(-) diff --git a/demos/AVR/RT-ARDUINOLEONARDO/usbcfg.c b/demos/AVR/RT-ARDUINOLEONARDO/usbcfg.c index b579c8144..09420baf7 100644 --- a/demos/AVR/RT-ARDUINOLEONARDO/usbcfg.c +++ b/demos/AVR/RT-ARDUINOLEONARDO/usbcfg.c @@ -302,7 +302,15 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: + chSysLockFromISR(); + + /* Disconnection event on suspend.*/ + sduDisconnectI(&SDU1); + + chSysUnlockFromISR(); return; case USB_EVENT_WAKEUP: return; diff --git a/demos/AVR/RT-PRO_MICRO/usbcfg.c b/demos/AVR/RT-PRO_MICRO/usbcfg.c index 575639150..91b0207ab 100644 --- a/demos/AVR/RT-PRO_MICRO/usbcfg.c +++ b/demos/AVR/RT-PRO_MICRO/usbcfg.c @@ -301,7 +301,15 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: + chSysLockFromISR(); + + /* Disconnection event on suspend.*/ + sduDisconnectI(&SDU1); + + chSysUnlockFromISR(); return; case USB_EVENT_WAKEUP: return; diff --git a/demos/AVR/RT-TEENSY2-USB/usbcfg.c b/demos/AVR/RT-TEENSY2-USB/usbcfg.c index a0c9ad258..5c20ee7d9 100644 --- a/demos/AVR/RT-TEENSY2-USB/usbcfg.c +++ b/demos/AVR/RT-TEENSY2-USB/usbcfg.c @@ -267,7 +267,15 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: + chSysLockFromISR(); + + /* Disconnection event on suspend.*/ + sduDisconnectI(&SDU1); + + chSysUnlockFromISR(); return; case USB_EVENT_WAKEUP: return; diff --git a/demos/STM32/RT-STM32F103-MAPLEMINI/usbcfg.c b/demos/STM32/RT-STM32F103-MAPLEMINI/usbcfg.c index 13a2e7ee3..949321a59 100644 --- a/demos/STM32/RT-STM32F103-MAPLEMINI/usbcfg.c +++ b/demos/STM32/RT-STM32F103-MAPLEMINI/usbcfg.c @@ -285,6 +285,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/demos/STM32/RT-STM32F103-STM3210E_EVAL-FATFS-USB/usbcfg.c b/demos/STM32/RT-STM32F103-STM3210E_EVAL-FATFS-USB/usbcfg.c index 13a2e7ee3..949321a59 100644 --- a/demos/STM32/RT-STM32F103-STM3210E_EVAL-FATFS-USB/usbcfg.c +++ b/demos/STM32/RT-STM32F103-STM3210E_EVAL-FATFS-USB/usbcfg.c @@ -285,6 +285,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/demos/STM32/RT-STM32F103_INEMO_DISCOVERY/usbcfg.c b/demos/STM32/RT-STM32F103_INEMO_DISCOVERY/usbcfg.c index 13a2e7ee3..949321a59 100644 --- a/demos/STM32/RT-STM32F103_INEMO_DISCOVERY/usbcfg.c +++ b/demos/STM32/RT-STM32F103_INEMO_DISCOVERY/usbcfg.c @@ -285,6 +285,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/demos/STM32/RT-STM32F407-OLIMEX_E407-LWIP-FATFS-USB/usbcfg.c b/demos/STM32/RT-STM32F407-OLIMEX_E407-LWIP-FATFS-USB/usbcfg.c index 13a2e7ee3..949321a59 100644 --- a/demos/STM32/RT-STM32F407-OLIMEX_E407-LWIP-FATFS-USB/usbcfg.c +++ b/demos/STM32/RT-STM32F407-OLIMEX_E407-LWIP-FATFS-USB/usbcfg.c @@ -285,6 +285,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/demos/STM32/RT-STM32F429-DISCOVERY/usbcfg.c b/demos/STM32/RT-STM32F429-DISCOVERY/usbcfg.c index 8cc4a9537..26ec6df67 100644 --- a/demos/STM32/RT-STM32F429-DISCOVERY/usbcfg.c +++ b/demos/STM32/RT-STM32F429-DISCOVERY/usbcfg.c @@ -285,6 +285,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/usbcfg.c b/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/usbcfg.c index 1a0858af3..e0c0d853b 100644 --- a/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/usbcfg.c +++ b/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/usbcfg.c @@ -285,6 +285,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/demos/STM32/RT-STM32L053-DISCOVERY/usbcfg.c b/demos/STM32/RT-STM32L053-DISCOVERY/usbcfg.c index 13a2e7ee3..949321a59 100644 --- a/demos/STM32/RT-STM32L053-DISCOVERY/usbcfg.c +++ b/demos/STM32/RT-STM32L053-DISCOVERY/usbcfg.c @@ -285,6 +285,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/os/hal/include/hal_usb.h b/os/hal/include/hal_usb.h index 0e9ecb238..71fa42498 100644 --- a/os/hal/include/hal_usb.h +++ b/os/hal/include/hal_usb.h @@ -301,9 +301,10 @@ typedef enum { USB_EVENT_RESET = 0, /**< Driver has been reset by host. */ USB_EVENT_ADDRESS = 1, /**< Address assigned. */ USB_EVENT_CONFIGURED = 2, /**< Configuration selected. */ - USB_EVENT_SUSPEND = 3, /**< Entering suspend mode. */ - USB_EVENT_WAKEUP = 4, /**< Leaving suspend mode. */ - USB_EVENT_STALLED = 5 /**< Endpoint 0 error, stalled. */ + USB_EVENT_UNCONFIGURED = 3, /**< Configuration removed. */ + USB_EVENT_SUSPEND = 4, /**< Entering suspend mode. */ + USB_EVENT_WAKEUP = 5, /**< Leaving suspend mode. */ + USB_EVENT_STALLED = 6 /**< Endpoint 0 error, stalled. */ } usbevent_t; /** diff --git a/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h b/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h index 168bc364b..2339a23f0 100644 --- a/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h +++ b/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h @@ -457,6 +457,10 @@ struct USBDriver { * @brief Current USB device configuration. */ uint8_t configuration; + /** + * @brief State of the driver when a suspend happened. + */ + usbstate_t saved_state; #if defined(USB_DRIVER_EXT_FIELDS) USB_DRIVER_EXT_FIELDS #endif diff --git a/os/hal/src/hal_serial_usb.c b/os/hal/src/hal_serial_usb.c index 7d4ed05a8..b97254fdd 100644 --- a/os/hal/src/hal_serial_usb.c +++ b/os/hal/src/hal_serial_usb.c @@ -50,6 +50,35 @@ static cdc_linecoding_t linecoding = { /* Driver local functions. */ /*===========================================================================*/ + +static bool sdu_start_receive(SerialUSBDriver *sdup) { + uint8_t *buf; + + /* If the USB driver is not in the appropriate state then transactions + must not be started.*/ + if ((usbGetDriverStateI(sdup->config->usbp) != USB_ACTIVE) || + (sdup->state != SDU_READY)) { + return true; + } + + /* Checking if there is already a transaction ongoing on the endpoint.*/ + if (usbGetReceiveStatusI(sdup->config->usbp, sdup->config->bulk_in)) { + return true; + } + + /* Checking if there is a buffer ready for incoming data.*/ + buf = ibqGetEmptyBufferI(&sdup->ibqueue); + if (buf == NULL) { + return true; + } + + /* Buffer found, starting a new transaction.*/ + usbStartReceiveI(sdup->config->usbp, sdup->config->bulk_out, + buf, SERIAL_USB_BUFFERS_SIZE); + + return false; +} + /* * Interface implementation. */ @@ -140,24 +169,7 @@ static const struct SerialUSBDriverVMT vmt = { */ static void ibnotify(io_buffers_queue_t *bqp) { SerialUSBDriver *sdup = bqGetLinkX(bqp); - - /* If the USB driver is not in the appropriate state then transactions - must not be started.*/ - if ((usbGetDriverStateI(sdup->config->usbp) != USB_ACTIVE) || - (sdup->state != SDU_READY)) { - return; - } - - /* Checking if there is already a transaction ongoing on the endpoint.*/ - if (!usbGetReceiveStatusI(sdup->config->usbp, sdup->config->bulk_out)) { - /* Trying to get a free buffer.*/ - uint8_t *buf = ibqGetEmptyBufferI(&sdup->ibqueue); - if (buf != NULL) { - /* Buffer found, starting a new transaction.*/ - usbStartReceiveI(sdup->config->usbp, sdup->config->bulk_out, - buf, SERIAL_USB_BUFFERS_SIZE); - } - } + (void) sdu_start_receive(sdup); } /** @@ -309,19 +321,11 @@ void sduDisconnectI(SerialUSBDriver *sdup) { * @iclass */ void sduConfigureHookI(SerialUSBDriver *sdup) { - uint8_t *buf; ibqResetI(&sdup->ibqueue); obqResetI(&sdup->obqueue); chnAddFlagsI(sdup, CHN_CONNECTED); - - /* Starts the first OUT transaction immediately.*/ - buf = ibqGetEmptyBufferI(&sdup->ibqueue); - - osalDbgAssert(buf != NULL, "no free buffer"); - - usbStartReceiveI(sdup->config->usbp, sdup->config->bulk_out, - buf, SERIAL_USB_BUFFERS_SIZE); + (void) sdu_start_receive(sdup); } /** @@ -457,9 +461,7 @@ void sduDataTransmitted(USBDriver *usbp, usbep_t ep) { * @param[in] ep OUT endpoint number */ void sduDataReceived(USBDriver *usbp, usbep_t ep) { - uint8_t *buf; SerialUSBDriver *sdup = usbp->out_params[ep - 1U]; - if (sdup == NULL) { return; } @@ -477,12 +479,7 @@ void sduDataReceived(USBDriver *usbp, usbep_t ep) { /* The endpoint cannot be busy, we are in the context of the callback, so a packet is in the buffer for sure. Trying to get a free buffer for the next transaction.*/ - buf = ibqGetEmptyBufferI(&sdup->ibqueue); - if (buf != NULL) { - /* Buffer found, starting a new transaction.*/ - usbStartReceiveI(sdup->config->usbp, sdup->config->bulk_out, - buf, SERIAL_USB_BUFFERS_SIZE); - } + sdu_start_receive(sdup); osalSysUnlockFromISR(); } diff --git a/os/hal/src/hal_usb.c b/os/hal/src/hal_usb.c index d6d5b6606..c10bf0d56 100644 --- a/os/hal/src/hal_usb.c +++ b/os/hal/src/hal_usb.c @@ -144,12 +144,20 @@ static bool default_handler(USBDriver *usbp) { /* Handling configuration selection from the host.*/ usbp->configuration = usbp->setup[2]; if (usbp->configuration == 0U) { - usbp->state = USB_SELECTED; + if (usbp->state == USB_ACTIVE) { + chSysLockFromISR (); + usbDisableEndpointsI(usbp); + chSysUnlockFromISR (); + usbp->state = USB_SELECTED; + _usb_isr_invoke_event_cb(usbp, USB_EVENT_UNCONFIGURED); + } } else { - usbp->state = USB_ACTIVE; + if (usbp->state != USB_ACTIVE) { + usbp->state = USB_ACTIVE; + _usb_isr_invoke_event_cb(usbp, USB_EVENT_CONFIGURED); + } } - _usb_isr_invoke_event_cb(usbp, USB_EVENT_CONFIGURED); usbSetupTransfer(usbp, NULL, 0, NULL); return true; case (uint32_t)USB_RTYPE_RECIPIENT_INTERFACE | ((uint32_t)USB_REQ_GET_STATUS << 8): @@ -318,8 +326,8 @@ void usbStop(USBDriver *usbp) { osalDbgAssert((usbp->state == USB_STOP) || (usbp->state == USB_READY) || (usbp->state == USB_SELECTED) || (usbp->state == USB_ACTIVE) || (usbp->state == USB_SUSPENDED), - "invalid state"); + usb_lld_stop(usbp); usbp->config = NULL; usbp->state = USB_STOP; @@ -396,10 +404,11 @@ void usbDisableEndpointsI(USBDriver *usbp) { osalDbgCheckClassI(); osalDbgCheck(usbp != NULL); - osalDbgAssert(usbp->state == USB_SELECTED, "invalid state"); + osalDbgAssert(usbp->state == USB_ACTIVE, "invalid state"); + + usbp->transmitting &= 1U; + usbp->receiving &= 1U; - usbp->transmitting &= ~1U; - usbp->receiving &= ~1U; for (i = 1; i <= (unsigned)USB_MAX_ENDPOINTS; i++) { #if USB_USE_WAIT == TRUE /* Signaling the event to threads waiting on endpoints.*/ @@ -679,9 +688,11 @@ void _usb_reset(USBDriver *usbp) { * @notapi */ void _usb_suspend(USBDriver *usbp) { + /* No state change, suspend always returns to previous state. */ /* State transition.*/ - usbp->state = USB_SUSPENDED; + usbp->saved_state = usbp->state; + usbp->state = USB_SUSPENDED; /* Notification of suspend event.*/ _usb_isr_invoke_event_cb(usbp, USB_EVENT_SUSPEND); @@ -718,8 +729,8 @@ void _usb_suspend(USBDriver *usbp) { */ void _usb_wakeup(USBDriver *usbp) { - /* State transition.*/ - usbp->state = USB_ACTIVE; + /* State transition, returning to the previous state.*/ + usbp->state = usbp->saved_state; /* Notification of suspend event.*/ _usb_isr_invoke_event_cb(usbp, USB_EVENT_WAKEUP); diff --git a/testhal/STM32/STM32F0xx/USB_CDC/usbcfg.c b/testhal/STM32/STM32F0xx/USB_CDC/usbcfg.c index 596513957..1a46b170a 100644 --- a/testhal/STM32/STM32F0xx/USB_CDC/usbcfg.c +++ b/testhal/STM32/STM32F0xx/USB_CDC/usbcfg.c @@ -285,6 +285,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/testhal/STM32/STM32F1xx/USB_CDC/usbcfg.c b/testhal/STM32/STM32F1xx/USB_CDC/usbcfg.c index 13a2e7ee3..949321a59 100644 --- a/testhal/STM32/STM32F1xx/USB_CDC/usbcfg.c +++ b/testhal/STM32/STM32F1xx/USB_CDC/usbcfg.c @@ -285,6 +285,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/testhal/STM32/STM32F2xx/USB_CDC/usbcfg.c b/testhal/STM32/STM32F2xx/USB_CDC/usbcfg.c index 13a2e7ee3..949321a59 100644 --- a/testhal/STM32/STM32F2xx/USB_CDC/usbcfg.c +++ b/testhal/STM32/STM32F2xx/USB_CDC/usbcfg.c @@ -285,6 +285,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/testhal/STM32/STM32F37x/USB_CDC/usbcfg.c b/testhal/STM32/STM32F37x/USB_CDC/usbcfg.c index 13a2e7ee3..949321a59 100644 --- a/testhal/STM32/STM32F37x/USB_CDC/usbcfg.c +++ b/testhal/STM32/STM32F37x/USB_CDC/usbcfg.c @@ -285,6 +285,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/testhal/STM32/STM32F3xx/I2C-LSM303DLHC/usbcfg.c b/testhal/STM32/STM32F3xx/I2C-LSM303DLHC/usbcfg.c index 13a2e7ee3..949321a59 100644 --- a/testhal/STM32/STM32F3xx/I2C-LSM303DLHC/usbcfg.c +++ b/testhal/STM32/STM32F3xx/I2C-LSM303DLHC/usbcfg.c @@ -285,6 +285,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/testhal/STM32/STM32F3xx/SPI-L3GD20/usbcfg.c b/testhal/STM32/STM32F3xx/SPI-L3GD20/usbcfg.c index 13a2e7ee3..949321a59 100644 --- a/testhal/STM32/STM32F3xx/SPI-L3GD20/usbcfg.c +++ b/testhal/STM32/STM32F3xx/SPI-L3GD20/usbcfg.c @@ -285,6 +285,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/testhal/STM32/STM32F3xx/USB_CDC/usbcfg.c b/testhal/STM32/STM32F3xx/USB_CDC/usbcfg.c index 13a2e7ee3..949321a59 100644 --- a/testhal/STM32/STM32F3xx/USB_CDC/usbcfg.c +++ b/testhal/STM32/STM32F3xx/USB_CDC/usbcfg.c @@ -285,6 +285,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/testhal/STM32/STM32F3xx/USB_CDC_IAD/usbcfg.c b/testhal/STM32/STM32F3xx/USB_CDC_IAD/usbcfg.c index da342c10e..c265a9fd6 100644 --- a/testhal/STM32/STM32F3xx/USB_CDC_IAD/usbcfg.c +++ b/testhal/STM32/STM32F3xx/USB_CDC_IAD/usbcfg.c @@ -399,6 +399,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/testhal/STM32/STM32F4xx/I2C-LSM303DLHC/usbcfg.c b/testhal/STM32/STM32F4xx/I2C-LSM303DLHC/usbcfg.c index 13a2e7ee3..949321a59 100644 --- a/testhal/STM32/STM32F4xx/I2C-LSM303DLHC/usbcfg.c +++ b/testhal/STM32/STM32F4xx/I2C-LSM303DLHC/usbcfg.c @@ -285,6 +285,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/testhal/STM32/STM32F4xx/SPI-L3GD20/usbcfg.c b/testhal/STM32/STM32F4xx/SPI-L3GD20/usbcfg.c index 13a2e7ee3..949321a59 100644 --- a/testhal/STM32/STM32F4xx/SPI-L3GD20/usbcfg.c +++ b/testhal/STM32/STM32F4xx/SPI-L3GD20/usbcfg.c @@ -285,6 +285,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/testhal/STM32/STM32F4xx/SPI-LIS302DL/usbcfg.c b/testhal/STM32/STM32F4xx/SPI-LIS302DL/usbcfg.c index 13a2e7ee3..949321a59 100644 --- a/testhal/STM32/STM32F4xx/SPI-LIS302DL/usbcfg.c +++ b/testhal/STM32/STM32F4xx/SPI-LIS302DL/usbcfg.c @@ -285,6 +285,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/testhal/STM32/STM32F4xx/SPI-LIS3DSH/usbcfg.c b/testhal/STM32/STM32F4xx/SPI-LIS3DSH/usbcfg.c index 13a2e7ee3..949321a59 100644 --- a/testhal/STM32/STM32F4xx/SPI-LIS3DSH/usbcfg.c +++ b/testhal/STM32/STM32F4xx/SPI-LIS3DSH/usbcfg.c @@ -285,6 +285,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/testhal/STM32/STM32F4xx/USB_CDC/usbcfg.c b/testhal/STM32/STM32F4xx/USB_CDC/usbcfg.c index 13a2e7ee3..949321a59 100644 --- a/testhal/STM32/STM32F4xx/USB_CDC/usbcfg.c +++ b/testhal/STM32/STM32F4xx/USB_CDC/usbcfg.c @@ -285,6 +285,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/testhal/STM32/STM32F4xx/USB_CDC_IAD/usbcfg.c b/testhal/STM32/STM32F4xx/USB_CDC_IAD/usbcfg.c index 3bab607bc..c6318049a 100644 --- a/testhal/STM32/STM32F4xx/USB_CDC_IAD/usbcfg.c +++ b/testhal/STM32/STM32F4xx/USB_CDC_IAD/usbcfg.c @@ -399,6 +399,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/testhal/STM32/STM32F7xx/USB_CDC/usbcfg.c b/testhal/STM32/STM32F7xx/USB_CDC/usbcfg.c index 1a0858af3..e0c0d853b 100644 --- a/testhal/STM32/STM32F7xx/USB_CDC/usbcfg.c +++ b/testhal/STM32/STM32F7xx/USB_CDC/usbcfg.c @@ -285,6 +285,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: chSysLockFromISR(); diff --git a/testhal/STM32/STM32F7xx/USB_RAW/usbcfg.c b/testhal/STM32/STM32F7xx/USB_RAW/usbcfg.c index 6aff4fc49..9f279edc4 100644 --- a/testhal/STM32/STM32F7xx/USB_RAW/usbcfg.c +++ b/testhal/STM32/STM32F7xx/USB_RAW/usbcfg.c @@ -273,6 +273,8 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; + case USB_EVENT_UNCONFIGURED: + return; case USB_EVENT_SUSPEND: return; case USB_EVENT_WAKEUP: -- cgit v1.2.3