|
|
@@ -4,7 +4,11 @@
|
|
|
#include "hpm_usb_drv.h"
|
|
|
|
|
|
#if !defined(CONFIG_USB_EHCI_HPMICRO) || !CONFIG_USB_EHCI_HPMICRO
|
|
|
-#error "hpm ehci must set CONFIG_USB_EHCI_HPMICRO=1 and set CONFIG_HPM_USB_BASE=HPM_USB0_BASE"
|
|
|
+#error "hpm ehci must set CONFIG_USB_EHCI_HPMICRO=1"
|
|
|
+#endif
|
|
|
+
|
|
|
+#if !defined(CONFIG_HPM_USB_BASE) || !defined(CONFIG_HPM_USB_IRQn)
|
|
|
+#error "hpm ehci must config CONFIG_HPM_USB_BASE and CONFIG_HPM_USB_IRQn"
|
|
|
#endif
|
|
|
|
|
|
static void usb_host_mode_init(USB_Type *ptr)
|
|
|
@@ -28,20 +32,20 @@ static void usb_host_mode_init(USB_Type *ptr)
|
|
|
|
|
|
void usb_hc_low_level_init()
|
|
|
{
|
|
|
- usb_phy_init((USB_Type *)HPM_USB0_BASE);
|
|
|
- intc_m_enable_irq(IRQn_USB0);
|
|
|
+ usb_phy_init((USB_Type *)CONFIG_HPM_USB_BASE);
|
|
|
+ intc_m_enable_irq(CONFIG_HPM_USB_IRQn);
|
|
|
}
|
|
|
|
|
|
void usb_hc_low_level2_init()
|
|
|
{
|
|
|
- usb_host_mode_init((USB_Type *)HPM_USB0_BASE);
|
|
|
+ usb_host_mode_init((USB_Type *)CONFIG_HPM_USB_BASE);
|
|
|
}
|
|
|
|
|
|
uint8_t usbh_get_port_speed(const uint8_t port)
|
|
|
{
|
|
|
uint8_t speed;
|
|
|
|
|
|
- speed = usb_get_port_speed((USB_Type *)HPM_USB0_BASE);
|
|
|
+ speed = usb_get_port_speed((USB_Type *)CONFIG_HPM_USB_BASE);
|
|
|
|
|
|
if (speed == 0x00) {
|
|
|
return USB_SPEED_FULL;
|
|
|
@@ -58,15 +62,8 @@ uint8_t usbh_get_port_speed(const uint8_t port)
|
|
|
|
|
|
extern void USBH_IRQHandler(void);
|
|
|
|
|
|
-void isr_usb0(void)
|
|
|
+void isr_usb(void)
|
|
|
{
|
|
|
USBH_IRQHandler();
|
|
|
}
|
|
|
-SDK_DECLARE_EXT_ISR_M(IRQn_USB0, isr_usb0)
|
|
|
-
|
|
|
-#ifdef HPM_USB1_BASE
|
|
|
-void isr_usb1(void)
|
|
|
-{
|
|
|
-}
|
|
|
-SDK_DECLARE_EXT_ISR_M(IRQn_USB1, isr_usb1)
|
|
|
-#endif
|
|
|
+SDK_DECLARE_EXT_ISR_M(CONFIG_HPM_USB_IRQn, isr_usb)
|