aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2015-09-01 13:32:09 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2015-09-01 13:32:09 +0000
commit64689ec9b44217acd92443e88793a6e8387dd709 (patch)
tree53ddc083ee3d07284a3c4d5839207608ae61e140 /os/hal/ports
parent2c934bb1fa9037c5088ad7001d417f3e1598ccbf (diff)
downloadChibiOS-64689ec9b44217acd92443e88793a6e8387dd709.tar.gz
ChibiOS-64689ec9b44217acd92443e88793a6e8387dd709.tar.bz2
ChibiOS-64689ec9b44217acd92443e88793a6e8387dd709.zip
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
Diffstat (limited to 'os/hal/ports')
-rw-r--r--os/hal/ports/STM32/LLD/OTGv1/usb_lld.c5
-rw-r--r--os/hal/ports/STM32/LLD/OTGv1/usb_lld.h8
2 files changed, 11 insertions, 2 deletions
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. */