aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2016-06-04 15:15:12 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2016-06-04 15:15:12 +0000
commit9e015af3671b9691b601779973b6034b7627ce2a (patch)
treeacab7452253ec7517bd3881f03806b5c1b407a1b
parentba9897fa8d746f2087043b859ae213d2591ba368 (diff)
downloadChibiOS-9e015af3671b9691b601779973b6034b7627ce2a.tar.gz
ChibiOS-9e015af3671b9691b601779973b6034b7627ce2a.tar.bz2
ChibiOS-9e015af3671b9691b601779973b6034b7627ce2a.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9573 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c8
-rw-r--r--os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h35
-rw-r--r--os/hal/ports/STM32/STM32L4xx/stm32_registry.h2
3 files changed, 30 insertions, 15 deletions
diff --git a/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c b/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c
index e4dc04c7c..22ea69f31 100644
--- a/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c
+++ b/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c
@@ -54,8 +54,6 @@
#define GCCFG_INIT_VALUE (GCCFG_VBDEN | GCCFG_PWRDWN)
#endif
-#else
-#error "unsupported STM32_OTG_STEPPING"
#endif
/*===========================================================================*/
@@ -635,9 +633,6 @@ static void usb_lld_serve_interrupt(USBDriver *usbp) {
/*===========================================================================*/
#if STM32_USB_USE_OTG1 || defined(__DOXYGEN__)
-#if !defined(STM32_OTG1_HANDLER)
-#error "STM32_OTG1_HANDLER not defined"
-#endif
/**
* @brief OTG1 interrupt handler.
*
@@ -654,9 +649,6 @@ OSAL_IRQ_HANDLER(STM32_OTG1_HANDLER) {
#endif
#if STM32_USB_USE_OTG2 || defined(__DOXYGEN__)
-#if !defined(STM32_OTG2_HANDLER)
-#error "STM32_OTG2_HANDLER not defined"
-#endif
/**
* @brief OTG2 interrupt handler.
*
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 1132b8e7b..cdb61b770 100644
--- a/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h
+++ b/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h
@@ -146,6 +146,29 @@
/* Derived constants and error checks. */
/*===========================================================================*/
+/* Registry checks.*/
+#if !defined(STM32_OTG_STEPPING)
+#error "STM32_OTG_STEPPING not defined in registry"
+#endif
+
+#if (STM32_OTG_STEPPING < 1) || (STM32_OTG_STEPPING > 2)
+#error "unsupported STM32_OTG_STEPPING"
+#endif
+
+#if !defined(STM32_HAS_OTG1) || !defined(STM32_HAS_OTG2)
+#error "STM32_HAS_OTGx not defined in registry"
+#endif
+
+#if (STM32_USB_USE_OTG1 && !defined(STM32_OTG1_HANDLER)) || \
+ (STM32_USB_USE_OTG2 && !defined(STM32_OTG2_HANDLER))
+#error "STM32_OTGx_HANDLER not defined in registry"
+#endif
+
+#if (STM32_USB_USE_OTG1 && !defined(STM32_OTG1_NUMBER)) || \
+ (STM32_USB_USE_OTG2 && !defined(STM32_OTG2_NUMBER))
+#error "STM32_OTGx_NUMBER not defined in registry"
+#endif
+
/**
* @brief Maximum endpoint address.
*/
@@ -496,10 +519,10 @@ struct USBDriver {
*
* @api
*/
-#if defined(STM32F7XX) || defined(__DOXYGEN__)
-#define usb_lld_connect_bus(usbp) ((usbp)->otg->DCTL &= ~DCTL_SDIS)
-#else
+#if (STM32_OTG_STEPPING == 1) || defined(__DOXYGEN__)
#define usb_lld_connect_bus(usbp) ((usbp)->otg->GCCFG |= GCCFG_VBUSBSEN)
+#else
+#define usb_lld_connect_bus(usbp) ((usbp)->otg->DCTL &= ~DCTL_SDIS)
#endif
/**
@@ -507,10 +530,10 @@ struct USBDriver {
*
* @api
*/
-#if defined(STM32F7XX) || defined(__DOXYGEN__)
-#define usb_lld_disconnect_bus(usbp) ((usbp)->otg->DCTL |= DCTL_SDIS)
-#else
+#if (STM32_OTG_STEPPING == 1) || defined(__DOXYGEN__)
#define usb_lld_disconnect_bus(usbp) ((usbp)->otg->GCCFG &= ~GCCFG_VBUSBSEN)
+#else
+#define usb_lld_disconnect_bus(usbp) ((usbp)->otg->DCTL |= DCTL_SDIS)
#endif
/*===========================================================================*/
diff --git a/os/hal/ports/STM32/STM32L4xx/stm32_registry.h b/os/hal/ports/STM32/STM32L4xx/stm32_registry.h
index e9d6aeee7..226df2247 100644
--- a/os/hal/ports/STM32/STM32L4xx/stm32_registry.h
+++ b/os/hal/ports/STM32/STM32L4xx/stm32_registry.h
@@ -397,7 +397,7 @@
#define STM32_HAS_UART8 FALSE
/* USB attributes.*/
-#define STM32_OTG_STEPPING 1
+#define STM32_OTG_STEPPING 2
#define STM32_HAS_OTG1 TRUE
#define STM32_OTG1_HANDLER Vector14C
#define STM32_OTG1_NUMBER 67