From 6184745e4e2c15aea3c78b7e2e8639fd6cbf7bf6 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 20 Dec 2014 16:53:05 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7589 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/STM32/LLD/USBv1/stm32_usb.h | 16 ++++++++-------- os/hal/ports/STM32/LLD/USBv1/usb_lld.h | 20 ++++++++++++++++++++ os/hal/ports/STM32/STM32F0xx/stm32_registry.h | 1 + os/hal/ports/STM32/STM32F1xx/stm32_registry.h | 3 +++ os/hal/ports/STM32/STM32F37x/stm32_registry.h | 1 + os/hal/ports/STM32/STM32F3xx/stm32_registry.h | 5 +++++ os/hal/ports/STM32/STM32L1xx/stm32_registry.h | 2 ++ 7 files changed, 40 insertions(+), 8 deletions(-) (limited to 'os') diff --git a/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h b/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h index 69f7beb62..7b74bf7d9 100644 --- a/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h +++ b/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h @@ -65,6 +65,14 @@ typedef struct { * @brief Buffer Table Address. */ volatile uint32_t BTABLE; + /* + * @brief LPM Control and Status Register. + */ + volatile uint32_t LPMCSR; + /* + * @brief Battery Charging Detector + */ + volatile uint32_t BCDR; } stm32_usb_t; /** @@ -95,14 +103,6 @@ typedef struct { * @brief RX counter register 1. */ volatile uint16_t RXCOUNT1; - /* - * @brief LPM Control and Status Register. - */ - volatile uint32_t LPMCSR; - /* - * @brief Battery Charging Detector - */ - volatile uint32_t BCDR; } stm32_usb_descriptor_t; /** diff --git a/os/hal/ports/STM32/LLD/USBv1/usb_lld.h b/os/hal/ports/STM32/LLD/USBv1/usb_lld.h index 090200641..b32597921 100644 --- a/os/hal/ports/STM32/LLD/USBv1/usb_lld.h +++ b/os/hal/ports/STM32/LLD/USBv1/usb_lld.h @@ -404,6 +404,26 @@ struct USBDriver { #define usb_lld_get_transaction_size(usbp, ep) \ ((usbp)->epc[ep]->out_state->rxcnt) +#if STM32_USB_HAS_BCDR || defined(__DOXYGEN__) +/** + * @brief Connects the USB device. + * + * @api + */ +#if !defined(usb_lld_connect_bus) +#define usb_lld_connect_bus(usbp) (STM32_USB->BCDR |= USB_BCDR_DPPU) +#endif + +/** + * @brief Disconnect the USB device. + * + * @api + */ +#if !defined(usb_lld_disconnect_bus) +#define usb_lld_disconnect_bus(usbp) (STM32_USB->BCDR &= ~USB_BCDR_DPPU) +#endif +#endif /* STM32_USB_HAS_BCDR */ + /*===========================================================================*/ /* External declarations. */ /*===========================================================================*/ diff --git a/os/hal/ports/STM32/STM32F0xx/stm32_registry.h b/os/hal/ports/STM32/STM32F0xx/stm32_registry.h index 19607550c..0745791ba 100644 --- a/os/hal/ports/STM32/STM32F0xx/stm32_registry.h +++ b/os/hal/ports/STM32/STM32F0xx/stm32_registry.h @@ -195,6 +195,7 @@ #if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F072xB) || \ defined(STM32F078xx) #define STM32_HAS_USB TRUE +#define STM32_USB_HAS_BCDR TRUE #else #define STM32_HAS_USB FALSE #endif diff --git a/os/hal/ports/STM32/STM32F1xx/stm32_registry.h b/os/hal/ports/STM32/STM32F1xx/stm32_registry.h index bc09c7d59..474bf1332 100644 --- a/os/hal/ports/STM32/STM32F1xx/stm32_registry.h +++ b/os/hal/ports/STM32/STM32F1xx/stm32_registry.h @@ -582,6 +582,7 @@ /* USB attributes.*/ #define STM32_HAS_USB TRUE +#define STM32_USB_HAS_BCDR FALSE #define STM32_HAS_OTG1 FALSE #define STM32_HAS_OTG2 FALSE /** @} */ @@ -756,6 +757,7 @@ /* USB attributes.*/ #define STM32_HAS_USB TRUE +#define STM32_USB_HAS_BCDR FALSE #define STM32_HAS_OTG1 FALSE #define STM32_HAS_OTG2 FALSE /** @} */ @@ -930,6 +932,7 @@ /* USB attributes.*/ #define STM32_HAS_USB TRUE +#define STM32_USB_HAS_BCDR FALSE #define STM32_HAS_OTG1 FALSE #define STM32_HAS_OTG2 FALSE /** @} */ diff --git a/os/hal/ports/STM32/STM32F37x/stm32_registry.h b/os/hal/ports/STM32/STM32F37x/stm32_registry.h index 08c940a39..e0a38489a 100644 --- a/os/hal/ports/STM32/STM32F37x/stm32_registry.h +++ b/os/hal/ports/STM32/STM32F37x/stm32_registry.h @@ -206,6 +206,7 @@ /* USB attributes.*/ #define STM32_HAS_USB TRUE +#define STM32_USB_HAS_BCDR FALSE #define STM32_HAS_OTG1 FALSE #define STM32_HAS_OTG2 FALSE #endif /* defined(STM32F373xC) */ diff --git a/os/hal/ports/STM32/STM32F3xx/stm32_registry.h b/os/hal/ports/STM32/STM32F3xx/stm32_registry.h index 1336a6ed8..b60a40dc6 100644 --- a/os/hal/ports/STM32/STM32F3xx/stm32_registry.h +++ b/os/hal/ports/STM32/STM32F3xx/stm32_registry.h @@ -204,6 +204,7 @@ /* USB attributes.*/ #define STM32_HAS_USB TRUE +#define STM32_USB_HAS_BCDR FALSE #define STM32_HAS_OTG1 FALSE #define STM32_HAS_OTG2 FALSE #endif /* defined(STM32F303xC) */ @@ -658,6 +659,7 @@ /* USB attributes.*/ #define STM32_HAS_USB TRUE +#define STM32_USB_HAS_BCDR FALSE #define STM32_HAS_OTG1 FALSE #define STM32_HAS_OTG2 FALSE #endif /* defined(STM32F302x8) */ @@ -821,6 +823,7 @@ /* USB attributes.*/ #define STM32_HAS_USB TRUE +#define STM32_USB_HAS_BCDR FALSE #define STM32_HAS_OTG1 FALSE #define STM32_HAS_OTG2 FALSE #endif /* defined(STM32F302xC) */ @@ -971,6 +974,7 @@ /* USB attributes.*/ #define STM32_HAS_USB TRUE +#define STM32_USB_HAS_BCDR FALSE #define STM32_HAS_OTG1 FALSE #define STM32_HAS_OTG2 FALSE #endif /* defined(STM32F318x8) */ @@ -1283,6 +1287,7 @@ /* USB attributes.*/ #define STM32_HAS_USB TRUE +#define STM32_USB_HAS_BCDR FALSE #define STM32_HAS_OTG1 FALSE #define STM32_HAS_OTG2 FALSE #endif /* defined(STM32F358xC) */ diff --git a/os/hal/ports/STM32/STM32L1xx/stm32_registry.h b/os/hal/ports/STM32/STM32L1xx/stm32_registry.h index 08e5cc012..b9e811dd8 100644 --- a/os/hal/ports/STM32/STM32L1xx/stm32_registry.h +++ b/os/hal/ports/STM32/STM32L1xx/stm32_registry.h @@ -178,6 +178,7 @@ /* USB attributes.*/ #define STM32_HAS_USB TRUE +#define STM32_USB_HAS_BCDR FALSE #define STM32_HAS_OTG1 FALSE #define STM32_HAS_OTG2 FALSE @@ -333,6 +334,7 @@ /* USB attributes.*/ #define STM32_HAS_USB TRUE +#define STM32_USB_HAS_BCDR FALSE #define STM32_HAS_OTG1 FALSE #define STM32_HAS_OTG2 FALSE -- cgit v1.2.3