aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/STM32/LLD/USBv1
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-12-20 16:53:05 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-12-20 16:53:05 +0000
commit6184745e4e2c15aea3c78b7e2e8639fd6cbf7bf6 (patch)
tree04d85548e943d1434d088b815f307ffde222f75c /os/hal/ports/STM32/LLD/USBv1
parent2e7aee242c1df1223b46abaaef063b0bbccd77e9 (diff)
downloadChibiOS-6184745e4e2c15aea3c78b7e2e8639fd6cbf7bf6.tar.gz
ChibiOS-6184745e4e2c15aea3c78b7e2e8639fd6cbf7bf6.tar.bz2
ChibiOS-6184745e4e2c15aea3c78b7e2e8639fd6cbf7bf6.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7589 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/ports/STM32/LLD/USBv1')
-rw-r--r--os/hal/ports/STM32/LLD/USBv1/stm32_usb.h16
-rw-r--r--os/hal/ports/STM32/LLD/USBv1/usb_lld.h20
2 files changed, 28 insertions, 8 deletions
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. */
/*===========================================================================*/