diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2016-10-13 13:07:20 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2016-10-13 13:07:20 +0000 |
commit | f6a1b7e01daa3873707588472482688b18eecca7 (patch) | |
tree | 803ce2502475c20cb215df1c631fac8846826827 /os/hal | |
parent | 0f0af8222f1868a408e00b4cb9e7c8d03623340c (diff) | |
download | ChibiOS-f6a1b7e01daa3873707588472482688b18eecca7.tar.gz ChibiOS-f6a1b7e01daa3873707588472482688b18eecca7.tar.bz2 ChibiOS-f6a1b7e01daa3873707588472482688b18eecca7.zip |
Improved OTG number of endpoints handling.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9860 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal')
-rw-r--r-- | os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h | 18 | ||||
-rw-r--r-- | os/hal/ports/STM32/STM32F1xx/stm32_registry.h | 1 | ||||
-rw-r--r-- | os/hal/ports/STM32/STM32F4xx/stm32_registry.h | 10 | ||||
-rw-r--r-- | os/hal/ports/STM32/STM32F7xx/stm32_registry.h | 2 | ||||
-rw-r--r-- | os/hal/ports/STM32/STM32L4xx/stm32_registry.h | 1 |
5 files changed, 29 insertions, 3 deletions
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 2339a23f0..38dde56b2 100644 --- a/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h +++ b/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h @@ -159,6 +159,14 @@ #error "STM32_HAS_OTGx not defined in registry"
#endif
+#if STM32_HAS_OTG1 && !defined(STM32_OTG1_ENDPOINTS)
+#error "STM32_OTG1_ENDPOINTS not defined in registry"
+#endif
+
+#if STM32_HAS_OTG2 && !defined(STM32_OTG2_ENDPOINTS)
+#error "STM32_OTG2_ENDPOINTS 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"
@@ -172,10 +180,14 @@ /**
* @brief Maximum endpoint address.
*/
-#if !STM32_USB_USE_OTG2 || defined(__DOXYGEN__)
-#define USB_MAX_ENDPOINTS 3
+#if (STM32_HAS_OTG2 && STM32_USB_USE_OTG2) || defined(__DOXYGEN__)
+#if (STM32_OTG1_ENDPOINTS < STM32_OTG2_ENDPOINTS) || defined(__DOXYGEN__)
+#define USB_MAX_ENDPOINTS STM32_OTG2_ENDPOINTS
+#else
+#define USB_MAX_ENDPOINTS STM32_OTG1_ENDPOINTS
+#endif
#else
-#define USB_MAX_ENDPOINTS 5
+#define USB_MAX_ENDPOINTS STM32_OTG1_ENDPOINTS
#endif
#if STM32_USB_USE_OTG1 && !STM32_HAS_OTG1
diff --git a/os/hal/ports/STM32/STM32F1xx/stm32_registry.h b/os/hal/ports/STM32/STM32F1xx/stm32_registry.h index 7e8388aa0..55adec556 100644 --- a/os/hal/ports/STM32/STM32F1xx/stm32_registry.h +++ b/os/hal/ports/STM32/STM32F1xx/stm32_registry.h @@ -1334,6 +1334,7 @@ /* USB attributes.*/
#define STM32_OTG_STEPPING 1
#define STM32_HAS_OTG1 TRUE
+#define STM32_OTG1_ENDPOINTS 3
#define STM32_HAS_OTG2 FALSE
#define STM32_HAS_USB FALSE
diff --git a/os/hal/ports/STM32/STM32F4xx/stm32_registry.h b/os/hal/ports/STM32/STM32F4xx/stm32_registry.h index f0b2d1db5..3e708d980 100644 --- a/os/hal/ports/STM32/STM32F4xx/stm32_registry.h +++ b/os/hal/ports/STM32/STM32F4xx/stm32_registry.h @@ -415,7 +415,9 @@ /* USB attributes.*/
#define STM32_OTG_STEPPING 2
#define STM32_HAS_OTG1 TRUE
+#define STM32_OTG1_ENDPOINTS 5
#define STM32_HAS_OTG2 TRUE
+#define STM32_OTG2_ENDPOINTS 8
#define STM32_HAS_USB FALSE
@@ -756,7 +758,9 @@ /* USB attributes.*/
#define STM32_OTG_STEPPING 2
#define STM32_HAS_OTG1 TRUE
+#define STM32_OTG1_ENDPOINTS 6
#define STM32_HAS_OTG2 TRUE
+#define STM32_OTG2_ENDPOINTS 8
#define STM32_HAS_USB FALSE
@@ -1119,7 +1123,9 @@ /* USB attributes.*/
#define STM32_OTG_STEPPING 1
#define STM32_HAS_OTG1 TRUE
+#define STM32_OTG1_ENDPOINTS 3
#define STM32_HAS_OTG2 TRUE
+#define STM32_OTG2_ENDPOINTS 5
#define STM32_HAS_USB FALSE
@@ -1460,7 +1466,9 @@ /* USB attributes.*/
#define STM32_OTG_STEPPING 1
#define STM32_HAS_OTG1 TRUE
+#define STM32_OTG1_ENDPOINTS 3
#define STM32_HAS_OTG2 TRUE
+#define STM32_OTG2_ENDPOINTS 5
#define STM32_HAS_USB FALSE
@@ -1752,6 +1760,7 @@ /* USB attributes.*/
#define STM32_OTG_STEPPING 1
#define STM32_HAS_OTG1 TRUE
+#define STM32_OTG1_ENDPOINTS 4
#define STM32_HAS_OTG2 FALSE
#define STM32_HAS_USB FALSE
@@ -2307,6 +2316,7 @@ /* USB attributes.*/
#define STM32_OTG_STEPPING 1
#define STM32_HAS_OTG1 TRUE
+#define STM32_OTG1_ENDPOINTS 4
#define STM32_HAS_OTG2 FALSE
#define STM32_HAS_USB FALSE
diff --git a/os/hal/ports/STM32/STM32F7xx/stm32_registry.h b/os/hal/ports/STM32/STM32F7xx/stm32_registry.h index 4d2857b0f..b2b84dde0 100644 --- a/os/hal/ports/STM32/STM32F7xx/stm32_registry.h +++ b/os/hal/ports/STM32/STM32F7xx/stm32_registry.h @@ -462,10 +462,12 @@ /* USB attributes.*/
#define STM32_OTG_STEPPING 2
#define STM32_HAS_OTG1 TRUE
+#define STM32_OTG1_ENDPOINTS 5
#define STM32_OTG1_HANDLER Vector14C
#define STM32_OTG1_NUMBER 67
#define STM32_HAS_OTG2 TRUE
+#define STM32_OTG2_ENDPOINTS 8
#define STM32_OTG2_HANDLER Vector174
#define STM32_OTG2_EP1OUT_HANDLER Vector168
#define STM32_OTG2_EP1IN_HANDLER Vector16C
diff --git a/os/hal/ports/STM32/STM32L4xx/stm32_registry.h b/os/hal/ports/STM32/STM32L4xx/stm32_registry.h index 226df2247..d5c228a7a 100644 --- a/os/hal/ports/STM32/STM32L4xx/stm32_registry.h +++ b/os/hal/ports/STM32/STM32L4xx/stm32_registry.h @@ -399,6 +399,7 @@ /* USB attributes.*/
#define STM32_OTG_STEPPING 2
#define STM32_HAS_OTG1 TRUE
+#define STM32_OTG1_ENDPOINTS 5
#define STM32_OTG1_HANDLER Vector14C
#define STM32_OTG1_NUMBER 67
|