diff options
Diffstat (limited to 'os/hal/ports/STM32/LLD')
-rw-r--r-- | os/hal/ports/STM32/LLD/USBv1/stm32_usb.h | 16 | ||||
-rw-r--r-- | os/hal/ports/STM32/LLD/USBv1/usb_lld.h | 20 |
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. */
/*===========================================================================*/
|