Fix device numbering

This commit is contained in:
Hanya 2021-09-09 18:15:14 +09:00
parent fbc9413df1
commit 42adcfe526
4 changed files with 18 additions and 12 deletions

View File

@ -83,7 +83,7 @@ void data_send(uint32_t data) {
/** /**
* @brief USB1 driver identifier. * @brief USB1 driver identifier.
*/ */
#if (RP_USB_USE_USBD1 == TRUE) || defined(__DOXYGEN__) #if (RP_USB_USE_USBD0 == TRUE) || defined(__DOXYGEN__)
USBDriver USBD1; USBDriver USBD1;
#endif #endif
@ -424,7 +424,7 @@ static void usb_serve_endpoint(USBDriver *usbp, usbep_t ep, bool is_in) {
/* Driver interrupt handlers and threads. */ /* 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. * @brief USB low priority interrupt handler.
@ -524,7 +524,7 @@ OSAL_IRQ_HANDLER(RP_USBCTRL_IRQ_HANDLER) {
OSAL_IRQ_EPILOGUE(); OSAL_IRQ_EPILOGUE();
} }
#endif /* RP_USB_USE_USBD1 */ #endif /* RP_USB_USE_USBD0 */
/*===========================================================================*/ /*===========================================================================*/
/* Driver exported functions. */ /* Driver exported functions. */
@ -536,7 +536,7 @@ OSAL_IRQ_HANDLER(RP_USBCTRL_IRQ_HANDLER) {
* @notapi * @notapi
*/ */
void usb_lld_init(void) { void usb_lld_init(void) {
#if RP_USB_USE_USBD1 == TRUE #if RP_USB_USE_USBD0 == TRUE
/* Driver initialization.*/ /* Driver initialization.*/
usbObjectInit(&USBD1); usbObjectInit(&USBD1);
@ -553,7 +553,7 @@ void usb_lld_init(void) {
* @notapi * @notapi
*/ */
void usb_lld_start(USBDriver *usbp) { void usb_lld_start(USBDriver *usbp) {
#if RP_USB_USE_USBD1 == TRUE #if RP_USB_USE_USBD0 == TRUE
#ifdef USB_DEBUG #ifdef USB_DEBUG
chMtxObjectInit(&cmtx); chMtxObjectInit(&cmtx);
#endif #endif
@ -606,7 +606,7 @@ void usb_lld_start(USBDriver *usbp) {
#endif /* RP_USB_USE_SOF_INTR */ #endif /* RP_USB_USE_SOF_INTR */
/* Enable USB interrupt. */ /* 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 */ /* Present full speed device by enabling pull up on DP */
USB->SET.SIECTRL = USB_SIE_CTRL_PULLUP_EN; USB->SET.SIECTRL = USB_SIE_CTRL_PULLUP_EN;
@ -623,7 +623,7 @@ void usb_lld_start(USBDriver *usbp) {
* @notapi * @notapi
*/ */
void usb_lld_stop(USBDriver *usbp) { void usb_lld_stop(USBDriver *usbp) {
#if RP_USB_USE_USBD1 == TRUE #if RP_USB_USE_USBD0 == TRUE
if (&USBD1 == usbp) { if (&USBD1 == usbp) {
if (usbp->state == USB_READY) { if (usbp->state == USB_READY) {
/* Disable interrupt */ /* Disable interrupt */

View File

@ -60,8 +60,8 @@
/** /**
* @brief USBD1 driver enable switch. * @brief USBD1 driver enable switch.
*/ */
#if !defined(RP_USB_USE_USBD1) || defined(__DOXYGEN__) #if !defined(RP_USB_USE_USBD0) || defined(__DOXYGEN__)
#define RP_USB_USE_USBD1 FALSE #define RP_USB_USE_USBD0 FALSE
#endif #endif
/** /**
@ -103,6 +103,10 @@ extern bool usb_vbus_detect(void);
#define RP_USB_USE_ERROR_DATA_SEQ_INTR FALSE #define RP_USB_USE_ERROR_DATA_SEQ_INTR FALSE
#endif #endif
#if !defined(RP_IRQ_USB0_PRIORITY)
#error "RP_IRQ_USB0_PRIORITY not defined in mcuconf.h"
#endif
/*===========================================================================*/ /*===========================================================================*/
/* Driver data structures and types. */ /* Driver data structures and types. */
/*===========================================================================*/ /*===========================================================================*/
@ -441,7 +445,7 @@ struct USBDriver {
/* External declarations. */ /* External declarations. */
/*===========================================================================*/ /*===========================================================================*/
#if RP_USB_USE_USBD1 && !defined(__DOXYGEN__) #if RP_USB_USE_USBD0 && !defined(__DOXYGEN__)
extern USBDriver USBD1; extern USBDriver USBD1;
#endif #endif

View File

@ -50,6 +50,7 @@
#define RP_IRQ_UART1_PRIORITY 3 #define RP_IRQ_UART1_PRIORITY 3
#define RP_IRQ_SPI0_PRIORITY 2 #define RP_IRQ_SPI0_PRIORITY 2
#define RP_IRQ_SPI1_PRIORITY 2 #define RP_IRQ_SPI1_PRIORITY 2
#define RP_IRQ_USB0_PRIORITY 2
/* /*
* SIO driver system settings. * SIO driver system settings.
@ -73,7 +74,7 @@
/* /*
* USB driver system settings. * 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_USB_FORCE_VBUS_DETECT TRUE
#define RP_USE_EXTERNAL_VBUS_DETECT FALSE #define RP_USE_EXTERNAL_VBUS_DETECT FALSE
#define RP_USB_USE_SOF_INTR FALSE #define RP_USB_USE_SOF_INTR FALSE

View File

@ -50,6 +50,7 @@
#define RP_IRQ_UART1_PRIORITY 3 #define RP_IRQ_UART1_PRIORITY 3
#define RP_IRQ_SPI0_PRIORITY 2 #define RP_IRQ_SPI0_PRIORITY 2
#define RP_IRQ_SPI1_PRIORITY 2 #define RP_IRQ_SPI1_PRIORITY 2
#define RP_IRQ_USB0_PRIORITY 2
/* /*
* SIO driver system settings. * SIO driver system settings.
@ -73,7 +74,7 @@
/* /*
* USB driver system settings. * 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_USB_FORCE_VBUS_DETECT TRUE
#define RP_USE_EXTERNAL_VBUS_DETECT FALSE #define RP_USE_EXTERNAL_VBUS_DETECT FALSE
#define RP_USB_USE_SOF_INTR TRUE #define RP_USB_USE_SOF_INTR TRUE