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.c | 10 | ||||
-rw-r--r-- | os/hal/ports/STM32/LLD/USBv1/usb_lld.h | 16 |
3 files changed, 35 insertions, 7 deletions
diff --git a/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h b/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h index d16b6266c..69f7beb62 100644 --- a/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h +++ b/os/hal/ports/STM32/LLD/USBv1/stm32_usb.h @@ -95,6 +95,14 @@ 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;
/**
@@ -108,12 +116,20 @@ typedef struct { /**
* @brief USB registers block numeric address.
*/
+#if defined(USB_BASE) || defined(__DOXYGEN__)
+#define STM32_USB_BASE USB_BASE
+#else
#define STM32_USB_BASE (APB1PERIPH_BASE + 0x5C00)
+#endif
/**
* @brief USB RAM numeric address.
*/
+#if defined(USB_PMAADDR) || defined(__DOXYGEN__)
+#define STM32_USBRAM_BASE USB_PMAADDR
+#else
#define STM32_USBRAM_BASE (APB1PERIPH_BASE + 0x6000)
+#endif
/**
* @brief Pointer to the USB registers block.
diff --git a/os/hal/ports/STM32/LLD/USBv1/usb_lld.c b/os/hal/ports/STM32/LLD/USBv1/usb_lld.c index 3a7ff272d..e606dc390 100644 --- a/os/hal/ports/STM32/LLD/USBv1/usb_lld.c +++ b/os/hal/ports/STM32/LLD/USBv1/usb_lld.c @@ -261,9 +261,7 @@ static void usb_packet_write_from_queue(stm32_usb_descriptor_t *udp, /*===========================================================================*/
#if STM32_USB_USE_USB1 || defined(__DOXYGEN__)
-#if !defined(STM32_USB1_HP_HANDLER)
-#error "STM32_USB1_HP_HANDLER not defined"
-#endif
+#if STM32_USB1_HP_NUMBER != STM32_USB1_LP_NUMBER
/**
* @brief USB high priority interrupt handler.
*
@@ -275,10 +273,8 @@ CH_IRQ_HANDLER(STM32_USB1_HP_HANDLER) { CH_IRQ_EPILOGUE();
}
+#endif /* STM32_USB1_LP_NUMBER != STM32_USB1_HP_NUMBER */
-#if !defined(STM32_USB1_LP_HANDLER)
-#error "STM32_USB1_LP_HANDLER not defined"
-#endif
/**
* @brief USB low priority interrupt handler.
*
@@ -416,7 +412,7 @@ CH_IRQ_HANDLER(STM32_USB1_LP_HANDLER) { CH_IRQ_EPILOGUE();
}
-#endif
+#endif /* STM32_USB_USE_USB1 */
/*===========================================================================*/
/* Driver exported functions. */
diff --git a/os/hal/ports/STM32/LLD/USBv1/usb_lld.h b/os/hal/ports/STM32/LLD/USBv1/usb_lld.h index ece8bf66a..090200641 100644 --- a/os/hal/ports/STM32/LLD/USBv1/usb_lld.h +++ b/os/hal/ports/STM32/LLD/USBv1/usb_lld.h @@ -108,6 +108,22 @@ #error "the USB driver requires a 48MHz clock"
#endif
+#if !defined(STM32_USB1_HP_HANDLER)
+#error "STM32_USB1_HP_HANDLER not defined"
+#endif
+
+#if !defined(STM32_USB1_HP_NUMBER)
+#error "STM32_USB1_HP_NUMBER not defined"
+#endif
+
+#if !defined(STM32_USB1_LP_HANDLER)
+#error "STM32_USB1_LP_HANDLER not defined"
+#endif
+
+#if !defined(STM32_USB1_LP_NUMBER)
+#error "STM32_USB1_LP_NUMBER not defined"
+#endif
+
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
|