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 ++++++++++++++++++++ 2 files changed, 28 insertions(+), 8 deletions(-) (limited to 'os/hal/ports/STM32/LLD/USBv1') 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. */ /*===========================================================================*/ -- cgit v1.2.3