diff --git a/os/hal/ports/RP/LLD/USBDv1/hal_usb_lld.c b/os/hal/ports/RP/LLD/USBDv1/hal_usb_lld.c index 24d06e80..c0da9c32 100644 --- a/os/hal/ports/RP/LLD/USBDv1/hal_usb_lld.c +++ b/os/hal/ports/RP/LLD/USBDv1/hal_usb_lld.c @@ -83,7 +83,7 @@ void data_send(uint32_t data) { /** * @brief USB1 driver identifier. */ -#if (RP_USB_USE_USBD1 == TRUE) || defined(__DOXYGEN__) +#if (RP_USB_USE_USBD0 == TRUE) || defined(__DOXYGEN__) USBDriver USBD1; #endif @@ -424,7 +424,7 @@ static void usb_serve_endpoint(USBDriver *usbp, usbep_t ep, bool is_in) { /* Driver interrupt handlers and threads. */ /*===========================================================================*/ -#if RP_USB_USE_USBD1 || defined(__DOXYGEN__) +#if RP_USB_USE_USBD0 || defined(__DOXYGEN__) /** * @brief USB low priority interrupt handler. @@ -524,7 +524,7 @@ OSAL_IRQ_HANDLER(RP_USBCTRL_IRQ_HANDLER) { OSAL_IRQ_EPILOGUE(); } -#endif /* RP_USB_USE_USBD1 */ +#endif /* RP_USB_USE_USBD0 */ /*===========================================================================*/ /* Driver exported functions. */ @@ -536,7 +536,7 @@ OSAL_IRQ_HANDLER(RP_USBCTRL_IRQ_HANDLER) { * @notapi */ void usb_lld_init(void) { -#if RP_USB_USE_USBD1 == TRUE +#if RP_USB_USE_USBD0 == TRUE /* Driver initialization.*/ usbObjectInit(&USBD1); @@ -553,7 +553,7 @@ void usb_lld_init(void) { * @notapi */ void usb_lld_start(USBDriver *usbp) { -#if RP_USB_USE_USBD1 == TRUE +#if RP_USB_USE_USBD0 == TRUE #ifdef USB_DEBUG chMtxObjectInit(&cmtx); #endif @@ -606,7 +606,7 @@ void usb_lld_start(USBDriver *usbp) { #endif /* RP_USB_USE_SOF_INTR */ /* Enable USB interrupt. */ - nvicEnableVector(RP_USBCTRL_IRQ_NUMBER, 2); + nvicEnableVector(RP_USBCTRL_IRQ_NUMBER, RP_IRQ_USB0_PRIORITY); /* Present full speed device by enabling pull up on DP */ USB->SET.SIECTRL = USB_SIE_CTRL_PULLUP_EN; @@ -623,7 +623,7 @@ void usb_lld_start(USBDriver *usbp) { * @notapi */ void usb_lld_stop(USBDriver *usbp) { -#if RP_USB_USE_USBD1 == TRUE +#if RP_USB_USE_USBD0 == TRUE if (&USBD1 == usbp) { if (usbp->state == USB_READY) { /* Disable interrupt */ diff --git a/os/hal/ports/RP/LLD/USBDv1/hal_usb_lld.h b/os/hal/ports/RP/LLD/USBDv1/hal_usb_lld.h index c6256525..fa811f6a 100644 --- a/os/hal/ports/RP/LLD/USBDv1/hal_usb_lld.h +++ b/os/hal/ports/RP/LLD/USBDv1/hal_usb_lld.h @@ -60,8 +60,8 @@ /** * @brief USBD1 driver enable switch. */ -#if !defined(RP_USB_USE_USBD1) || defined(__DOXYGEN__) -#define RP_USB_USE_USBD1 FALSE +#if !defined(RP_USB_USE_USBD0) || defined(__DOXYGEN__) +#define RP_USB_USE_USBD0 FALSE #endif /** @@ -103,6 +103,10 @@ extern bool usb_vbus_detect(void); #define RP_USB_USE_ERROR_DATA_SEQ_INTR FALSE #endif +#if !defined(RP_IRQ_USB0_PRIORITY) +#error "RP_IRQ_USB0_PRIORITY not defined in mcuconf.h" +#endif + /*===========================================================================*/ /* Driver data structures and types. */ /*===========================================================================*/ @@ -441,7 +445,7 @@ struct USBDriver { /* External declarations. */ /*===========================================================================*/ -#if RP_USB_USE_USBD1 && !defined(__DOXYGEN__) +#if RP_USB_USE_USBD0 && !defined(__DOXYGEN__) extern USBDriver USBD1; #endif diff --git a/testhal/RP/RP2040/RT-RP2040-PICO-HID/cfg/mcuconf.h b/testhal/RP/RP2040/RT-RP2040-PICO-HID/cfg/mcuconf.h index 44190602..cc76e866 100644 --- a/testhal/RP/RP2040/RT-RP2040-PICO-HID/cfg/mcuconf.h +++ b/testhal/RP/RP2040/RT-RP2040-PICO-HID/cfg/mcuconf.h @@ -50,6 +50,7 @@ #define RP_IRQ_UART1_PRIORITY 3 #define RP_IRQ_SPI0_PRIORITY 2 #define RP_IRQ_SPI1_PRIORITY 2 +#define RP_IRQ_USB0_PRIORITY 2 /* * SIO driver system settings. @@ -73,7 +74,7 @@ /* * USB driver system settings. */ -#define RP_USB_USE_USBD1 TRUE +#define RP_USB_USE_USBD0 TRUE #define RP_USB_FORCE_VBUS_DETECT TRUE #define RP_USE_EXTERNAL_VBUS_DETECT FALSE #define RP_USB_USE_SOF_INTR FALSE diff --git a/testhal/RP/RP2040/RT-RP2040-PICO-SERIAL/cfg/mcuconf.h b/testhal/RP/RP2040/RT-RP2040-PICO-SERIAL/cfg/mcuconf.h index f151ecd2..31a61fcd 100644 --- a/testhal/RP/RP2040/RT-RP2040-PICO-SERIAL/cfg/mcuconf.h +++ b/testhal/RP/RP2040/RT-RP2040-PICO-SERIAL/cfg/mcuconf.h @@ -50,6 +50,7 @@ #define RP_IRQ_UART1_PRIORITY 3 #define RP_IRQ_SPI0_PRIORITY 2 #define RP_IRQ_SPI1_PRIORITY 2 +#define RP_IRQ_USB0_PRIORITY 2 /* * SIO driver system settings. @@ -73,7 +74,7 @@ /* * USB driver system settings. */ -#define RP_USB_USE_USBD1 TRUE +#define RP_USB_USE_USBD0 TRUE #define RP_USB_FORCE_VBUS_DETECT TRUE #define RP_USE_EXTERNAL_VBUS_DETECT FALSE #define RP_USB_USE_SOF_INTR TRUE