From 64689ec9b44217acd92443e88793a6e8387dd709 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 1 Sep 2015 13:32:09 +0000 Subject: Improved STM32F4 USB_CDC demo, now it supports both the ST and Olimex boards. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8267 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/STM32/LLD/OTGv1/usb_lld.c | 5 +++-- os/hal/ports/STM32/LLD/OTGv1/usb_lld.h | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'os/hal/ports') diff --git a/os/hal/ports/STM32/LLD/OTGv1/usb_lld.c b/os/hal/ports/STM32/LLD/OTGv1/usb_lld.c index 650bc51bb..54e233b9d 100644 --- a/os/hal/ports/STM32/LLD/OTGv1/usb_lld.c +++ b/os/hal/ports/STM32/LLD/OTGv1/usb_lld.c @@ -852,9 +852,10 @@ void usb_lld_start(USBDriver *usbp) { otgp->GCCFG = GCCFG_PWRDWN; #else #if defined(BOARD_OTG_NOVBUSSENS) - otgp->GCCFG = GCCFG_NOVBUSSENS | GCCFG_PWRDWN; + otgp->GCCFG = GCCFG_NOVBUSSENS | GCCFG_VBUSASEN | GCCFG_VBUSBSEN | + GCCFG_PWRDWN; #else - otgp->GCCFG = GCCFG_PWRDWN; + otgp->GCCFG = GCCFG_VBUSASEN | GCCFG_VBUSBSEN | GCCFG_PWRDWN; #endif #endif diff --git a/os/hal/ports/STM32/LLD/OTGv1/usb_lld.h b/os/hal/ports/STM32/LLD/OTGv1/usb_lld.h index 8a1b26872..c1954f058 100644 --- a/os/hal/ports/STM32/LLD/OTGv1/usb_lld.h +++ b/os/hal/ports/STM32/LLD/OTGv1/usb_lld.h @@ -501,14 +501,22 @@ struct USBDriver { * * @api */ +#if defined(STM32F7XX) || defined(__DOXYGEN__) #define usb_lld_connect_bus(usbp) ((usbp)->otg->DCTL &= ~DCTL_SDIS) +#else +#define usb_lld_connect_bus(usbp) ((usbp)->otg->GCCFG |= GCCFG_VBUSBSEN) +#endif /** * @brief Disconnect the USB device. * * @api */ +#if defined(STM32F7XX) || defined(__DOXYGEN__) #define usb_lld_disconnect_bus(usbp) ((usbp)->otg->DCTL |= DCTL_SDIS) +#else +#define usb_lld_disconnect_bus(usbp) ((usbp)->otg->GCCFG &= ~GCCFG_VBUSBSEN) +#endif /*===========================================================================*/ /* External declarations. */ -- cgit v1.2.3