From 98bb7fb5df434b95253c5949444ee2dcff3a53b3 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Tue, 8 Sep 2015 13:36:30 +0000 Subject: Update USB demos with latest changes. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8288 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32/STM32F0xx/USB_CDC/main.c | 6 ++++++ testhal/STM32/STM32F1xx/USB_CDC/main.c | 6 ++++++ testhal/STM32/STM32F30x/USB_CDC/main.c | 6 ++++++ testhal/STM32/STM32F30x/USB_CDC_IAD/usbcfg.c | 7 +++++++ testhal/STM32/STM32F37x/USB_CDC/main.c | 6 ++++++ testhal/STM32/STM32F4xx/USB_CDC/Makefile | 2 +- testhal/STM32/STM32F4xx/USB_CDC/usbcfg.c | 6 ++++++ testhal/STM32/STM32F4xx/USB_CDC_IAD/Makefile | 2 +- testhal/STM32/STM32F4xx/USB_CDC_IAD/usbcfg.c | 7 +++++++ 9 files changed, 46 insertions(+), 2 deletions(-) (limited to 'testhal/STM32') diff --git a/testhal/STM32/STM32F0xx/USB_CDC/main.c b/testhal/STM32/STM32F0xx/USB_CDC/main.c index 2866b85ce..c37010da5 100644 --- a/testhal/STM32/STM32F0xx/USB_CDC/main.c +++ b/testhal/STM32/STM32F0xx/USB_CDC/main.c @@ -299,6 +299,12 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; case USB_EVENT_SUSPEND: + chSysLockFromISR(); + + /* Disconnection event on suspend.*/ + sduDisconnectI(&SDU1); + + chSysUnlockFromISR(); return; case USB_EVENT_WAKEUP: return; diff --git a/testhal/STM32/STM32F1xx/USB_CDC/main.c b/testhal/STM32/STM32F1xx/USB_CDC/main.c index eae64e0b5..5148d3eba 100644 --- a/testhal/STM32/STM32F1xx/USB_CDC/main.c +++ b/testhal/STM32/STM32F1xx/USB_CDC/main.c @@ -299,6 +299,12 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; case USB_EVENT_SUSPEND: + chSysLockFromISR(); + + /* Disconnection event on suspend.*/ + sduDisconnectI(&SDU1); + + chSysUnlockFromISR(); return; case USB_EVENT_WAKEUP: return; diff --git a/testhal/STM32/STM32F30x/USB_CDC/main.c b/testhal/STM32/STM32F30x/USB_CDC/main.c index c40a82cb1..c99d56466 100644 --- a/testhal/STM32/STM32F30x/USB_CDC/main.c +++ b/testhal/STM32/STM32F30x/USB_CDC/main.c @@ -306,6 +306,12 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; case USB_EVENT_SUSPEND: + chSysLockFromISR(); + + /* Disconnection event on suspend.*/ + sduDisconnectI(&SDU1); + + chSysUnlockFromISR(); return; case USB_EVENT_WAKEUP: return; diff --git a/testhal/STM32/STM32F30x/USB_CDC_IAD/usbcfg.c b/testhal/STM32/STM32F30x/USB_CDC_IAD/usbcfg.c index ef55d2bd8..70e55dbba 100644 --- a/testhal/STM32/STM32F30x/USB_CDC_IAD/usbcfg.c +++ b/testhal/STM32/STM32F30x/USB_CDC_IAD/usbcfg.c @@ -394,6 +394,13 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; case USB_EVENT_SUSPEND: + chSysLockFromISR(); + + /* Disconnection event on suspend.*/ + sduDisconnectI(&SDU1); + sduDisconnectI(&SDU2); + + chSysUnlockFromISR(); return; case USB_EVENT_WAKEUP: return; diff --git a/testhal/STM32/STM32F37x/USB_CDC/main.c b/testhal/STM32/STM32F37x/USB_CDC/main.c index 9eea7d19c..55252de37 100644 --- a/testhal/STM32/STM32F37x/USB_CDC/main.c +++ b/testhal/STM32/STM32F37x/USB_CDC/main.c @@ -305,6 +305,12 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; case USB_EVENT_SUSPEND: + chSysLockFromISR(); + + /* Disconnection event on suspend.*/ + sduDisconnectI(&SDU1); + + chSysUnlockFromISR(); return; case USB_EVENT_WAKEUP: return; diff --git a/testhal/STM32/STM32F4xx/USB_CDC/Makefile b/testhal/STM32/STM32F4xx/USB_CDC/Makefile index a8a9dd05c..48f6caeb3 100644 --- a/testhal/STM32/STM32F4xx/USB_CDC/Makefile +++ b/testhal/STM32/STM32F4xx/USB_CDC/Makefile @@ -5,7 +5,7 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 + USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). diff --git a/testhal/STM32/STM32F4xx/USB_CDC/usbcfg.c b/testhal/STM32/STM32F4xx/USB_CDC/usbcfg.c index f825ec239..cfe1a7f5c 100644 --- a/testhal/STM32/STM32F4xx/USB_CDC/usbcfg.c +++ b/testhal/STM32/STM32F4xx/USB_CDC/usbcfg.c @@ -284,6 +284,12 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; case USB_EVENT_SUSPEND: + chSysLockFromISR(); + + /* Disconnection event on suspend.*/ + sduDisconnectI(&SDU1); + + chSysUnlockFromISR(); return; case USB_EVENT_WAKEUP: return; diff --git a/testhal/STM32/STM32F4xx/USB_CDC_IAD/Makefile b/testhal/STM32/STM32F4xx/USB_CDC_IAD/Makefile index 56351076a..d5e19d9a2 100644 --- a/testhal/STM32/STM32F4xx/USB_CDC_IAD/Makefile +++ b/testhal/STM32/STM32F4xx/USB_CDC_IAD/Makefile @@ -5,7 +5,7 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 + USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). diff --git a/testhal/STM32/STM32F4xx/USB_CDC_IAD/usbcfg.c b/testhal/STM32/STM32F4xx/USB_CDC_IAD/usbcfg.c index 5abf0f520..873bea31e 100644 --- a/testhal/STM32/STM32F4xx/USB_CDC_IAD/usbcfg.c +++ b/testhal/STM32/STM32F4xx/USB_CDC_IAD/usbcfg.c @@ -394,6 +394,13 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { chSysUnlockFromISR(); return; case USB_EVENT_SUSPEND: + chSysLockFromISR(); + + /* Disconnection event on suspend.*/ + sduDisconnectI(&SDU1); + sduDisconnectI(&SDU2); + + chSysUnlockFromISR(); return; case USB_EVENT_WAKEUP: return; -- cgit v1.2.3