From 06377a341b6bc78e107554427b9278233d77c026 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 6 Apr 2020 18:00:37 +0700 Subject: [PATCH] add tud_irq_handler() for all lpc ip3511 (13, 15, 11) --- hw/bsp/lpcxpresso11u37/lpcxpresso11u37.c | 11 +++++++ hw/bsp/lpcxpresso11u68/lpcxpresso11u68.c | 11 +++++++ hw/bsp/lpcxpresso1347/lpcxpresso1347.c | 11 +++++++ hw/bsp/lpcxpresso1549/lpcxpresso1549.c | 11 +++++++ hw/bsp/lpcxpresso1769/lpcxpresso1769.c | 31 +++++++++++--------- hw/bsp/lpcxpresso51u68/lpcxpresso51u68.c | 11 +++++++ hw/bsp/lpcxpresso54114/lpcxpresso54114.c | 11 +++++++ hw/bsp/lpcxpresso55s69/lpcxpresso55s69.c | 16 ++++++++++ src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c | 6 ++-- 9 files changed, 102 insertions(+), 17 deletions(-) diff --git a/hw/bsp/lpcxpresso11u37/lpcxpresso11u37.c b/hw/bsp/lpcxpresso11u37/lpcxpresso11u37.c index 546dd3d13..6f2ae80e8 100644 --- a/hw/bsp/lpcxpresso11u37/lpcxpresso11u37.c +++ b/hw/bsp/lpcxpresso11u37/lpcxpresso11u37.c @@ -27,6 +27,17 @@ #include "chip.h" #include "../board.h" +//--------------------------------------------------------------------+ +// Forward USB interrupt events to TinyUSB IRQ Handler +//--------------------------------------------------------------------+ +void USB_IRQHandler(void) +{ + tud_irq_handler(0); +} + +//---------------------------------------------------------------- ----+ +// MACRO TYPEDEF CONSTANT ENUM +//--------------------------------------------------------------------+ #define LED_PORT 1 #define LED_PIN 24 #define LED_STATE_ON 0 diff --git a/hw/bsp/lpcxpresso11u68/lpcxpresso11u68.c b/hw/bsp/lpcxpresso11u68/lpcxpresso11u68.c index d062de7c3..193df3bb1 100644 --- a/hw/bsp/lpcxpresso11u68/lpcxpresso11u68.c +++ b/hw/bsp/lpcxpresso11u68/lpcxpresso11u68.c @@ -27,6 +27,17 @@ #include "chip.h" #include "../board.h" +//--------------------------------------------------------------------+ +// Forward USB interrupt events to TinyUSB IRQ Handler +//--------------------------------------------------------------------+ +void USB_IRQHandler(void) +{ + tud_irq_handler(0); +} + +//--------------------------------------------------------------------+ +// MACRO TYPEDEF CONSTANT ENUM +//--------------------------------------------------------------------+ #define LED_PORT 2 #define LED_PIN 17 #define LED_STATE_ON 0 diff --git a/hw/bsp/lpcxpresso1347/lpcxpresso1347.c b/hw/bsp/lpcxpresso1347/lpcxpresso1347.c index cc1a8deae..14a0009e4 100644 --- a/hw/bsp/lpcxpresso1347/lpcxpresso1347.c +++ b/hw/bsp/lpcxpresso1347/lpcxpresso1347.c @@ -27,6 +27,17 @@ #include "chip.h" #include "../board.h" +//--------------------------------------------------------------------+ +// Forward USB interrupt events to TinyUSB IRQ Handler +//--------------------------------------------------------------------+ +void USB_IRQHandler(void) +{ + tud_irq_handler(0); +} + +//--------------------------------------------------------------------+ +// MACRO TYPEDEF CONSTANT ENUM +//--------------------------------------------------------------------+ #define LED_PORT 0 #define LED_PIN 7 diff --git a/hw/bsp/lpcxpresso1549/lpcxpresso1549.c b/hw/bsp/lpcxpresso1549/lpcxpresso1549.c index 5f806d851..2ae8d7506 100644 --- a/hw/bsp/lpcxpresso1549/lpcxpresso1549.c +++ b/hw/bsp/lpcxpresso1549/lpcxpresso1549.c @@ -27,6 +27,17 @@ #include "chip.h" #include "../board.h" +//--------------------------------------------------------------------+ +// Forward USB interrupt events to TinyUSB IRQ Handler +//--------------------------------------------------------------------+ +void USB_IRQHandler(void) +{ + tud_irq_handler(0); +} + +//--------------------------------------------------------------------+ +// MACRO TYPEDEF CONSTANT ENUM +//--------------------------------------------------------------------+ #define LED_PORT 0 #define LED_PIN 25 diff --git a/hw/bsp/lpcxpresso1769/lpcxpresso1769.c b/hw/bsp/lpcxpresso1769/lpcxpresso1769.c index 9d955a763..3b5c9dcab 100644 --- a/hw/bsp/lpcxpresso1769/lpcxpresso1769.c +++ b/hw/bsp/lpcxpresso1769/lpcxpresso1769.c @@ -27,6 +27,23 @@ #include "chip.h" #include "../board.h" +//--------------------------------------------------------------------+ +// USB Interrupt Handler +//--------------------------------------------------------------------+ +void USB_IRQHandler(void) +{ + #if CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST + tuh_isr(0); + #endif + + #if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE + tud_irq_handler(0); + #endif +} + +//--------------------------------------------------------------------+ +// MACRO TYPEDEF CONSTANT ENUM +//--------------------------------------------------------------------+ #define LED_PORT 0 #define LED_PIN 22 #define LED_STATE_ON 1 @@ -143,20 +160,6 @@ void board_init(void) #endif } -//--------------------------------------------------------------------+ -// USB Interrupt Handler -//--------------------------------------------------------------------+ -void USB_IRQHandler(void) -{ - #if CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST - tuh_isr(0); - #endif - - #if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE - tud_irq_handler(0); - #endif -} - //--------------------------------------------------------------------+ // Board porting API //--------------------------------------------------------------------+ diff --git a/hw/bsp/lpcxpresso51u68/lpcxpresso51u68.c b/hw/bsp/lpcxpresso51u68/lpcxpresso51u68.c index 11b190b92..2a314388d 100644 --- a/hw/bsp/lpcxpresso51u68/lpcxpresso51u68.c +++ b/hw/bsp/lpcxpresso51u68/lpcxpresso51u68.c @@ -30,6 +30,17 @@ #include "fsl_power.h" #include "fsl_iocon.h" +//--------------------------------------------------------------------+ +// Forward USB interrupt events to TinyUSB IRQ Handler +//--------------------------------------------------------------------+ +void USB0_IRQHandler(void) +{ + tud_irq_handler(0); +} + +//--------------------------------------------------------------------+ +// MACRO TYPEDEF CONSTANT ENUM +//--------------------------------------------------------------------+ #define LED_PORT 0 #define LED_PIN 29 #define LED_STATE_ON 0 diff --git a/hw/bsp/lpcxpresso54114/lpcxpresso54114.c b/hw/bsp/lpcxpresso54114/lpcxpresso54114.c index d86af58c8..847accb67 100644 --- a/hw/bsp/lpcxpresso54114/lpcxpresso54114.c +++ b/hw/bsp/lpcxpresso54114/lpcxpresso54114.c @@ -30,6 +30,17 @@ #include "fsl_power.h" #include "fsl_iocon.h" +//--------------------------------------------------------------------+ +// Forward USB interrupt events to TinyUSB IRQ Handler +//--------------------------------------------------------------------+ +void USB0_IRQHandler(void) +{ + tud_irq_handler(0); +} + +//--------------------------------------------------------------------+ +// MACRO TYPEDEF CONSTANT ENUM +//--------------------------------------------------------------------+ #define LED_PORT 0 #define LED_PIN 29 #define LED_STATE_ON 0 diff --git a/hw/bsp/lpcxpresso55s69/lpcxpresso55s69.c b/hw/bsp/lpcxpresso55s69/lpcxpresso55s69.c index e595634a7..31519dc8f 100644 --- a/hw/bsp/lpcxpresso55s69/lpcxpresso55s69.c +++ b/hw/bsp/lpcxpresso55s69/lpcxpresso55s69.c @@ -30,6 +30,22 @@ #include "fsl_power.h" #include "fsl_iocon.h" +//--------------------------------------------------------------------+ +// Forward USB interrupt events to TinyUSB IRQ Handler +//--------------------------------------------------------------------+ +void USB0_IRQHandler(void) +{ + tud_irq_handler(0); +} + +void USB1_IRQHandler(void) +{ + tud_irq_handler(1); +} + +//--------------------------------------------------------------------+ +// MACRO TYPEDEF CONSTANT ENUM +//--------------------------------------------------------------------+ #define LED_PORT 1 #define LED_PIN 6 #define LED_STATE_ON 0 diff --git a/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c b/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c index 5b2bd83e9..9af8e6019 100644 --- a/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c +++ b/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c @@ -49,13 +49,11 @@ // LPC 11Uxx, 13xx, 15xx use lpcopen #include "chip.h" #define DCD_REGS LPC_USB - #define DCD_IRQHandler USB_IRQHandler #elif CFG_TUSB_MCU == OPT_MCU_LPC51UXX || CFG_TUSB_MCU == OPT_MCU_LPC54XXX || \ CFG_TUSB_MCU == OPT_MCU_LPC55XX // TODO 55xx has dual usb controllers #include "fsl_device_registers.h" #define DCD_REGS USB0 - #define DCD_IRQHandler USB0_IRQHandler #endif @@ -335,8 +333,10 @@ static void process_xfer_isr(uint32_t int_status) } } -void DCD_IRQHandler(void) +void dcd_irq_handler(uint8_t rhport) { + (void) rhport; // TODO support multiple USB on supported mcu such as LPC55s69 + uint32_t const cmd_stat = DCD_REGS->DEVCMDSTAT; uint32_t int_status = DCD_REGS->INTSTAT & DCD_REGS->INTEN;