summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorhathach <[email protected]>2020-04-08 16:26:14 +0700
committerhathach <[email protected]>2020-04-08 16:26:14 +0700
commit9014ca55284d755d15c39cd4f721ee60ac239c40 (patch)
tree1b27b7bcf533287fe5a7f0a01ddcc5a897f8a565 /hw
parentfc9170b2c1dca9348e50da2a3299950116cde0bd (diff)
move irq for stm32 fsdev
Diffstat (limited to 'hw')
-rw-r--r--hw/bsp/adafruit_clue/adafruit_clue.c7
-rw-r--r--hw/bsp/stm32f070rbnucleo/stm32f070rbnucleo.c14
-rw-r--r--hw/bsp/stm32f072disco/stm32f072disco.c12
-rw-r--r--hw/bsp/stm32f103bluepill/stm32f103bluepill.c22
-rw-r--r--hw/bsp/stm32f303disco/stm32f303disco.c34
-rw-r--r--hw/bsp/stm32l0538disco/stm32l0538disco.c12
6 files changed, 90 insertions, 11 deletions
diff --git a/hw/bsp/adafruit_clue/adafruit_clue.c b/hw/bsp/adafruit_clue/adafruit_clue.c
index 7b090dd45..54b822fc9 100644
--- a/hw/bsp/adafruit_clue/adafruit_clue.c
+++ b/hw/bsp/adafruit_clue/adafruit_clue.c
@@ -43,10 +43,9 @@ void USBD_IRQHandler(void)
tud_irq_handler(0);
}
-
-/*------------------------------------------------------------------*/
-/* MACRO TYPEDEF CONSTANT ENUM
- *------------------------------------------------------------------*/
+//--------------------------------------------------------------------+
+// MACRO TYPEDEF CONSTANT ENUM
+//--------------------------------------------------------------------+
#define _PINNUM(port, pin) ((port)*32 + (pin))
#define LED_PIN _PINNUM(1, 1)
diff --git a/hw/bsp/stm32f070rbnucleo/stm32f070rbnucleo.c b/hw/bsp/stm32f070rbnucleo/stm32f070rbnucleo.c
index b4d97aff8..132da8aee 100644
--- a/hw/bsp/stm32f070rbnucleo/stm32f070rbnucleo.c
+++ b/hw/bsp/stm32f070rbnucleo/stm32f070rbnucleo.c
@@ -25,9 +25,19 @@
*/
#include "../board.h"
-
#include "stm32f0xx_hal.h"
+//--------------------------------------------------------------------+
+// Forward USB interrupt events to TinyUSB IRQ Handler
+//--------------------------------------------------------------------+
+void USB_IRQHandler(void)
+{
+ tud_irq_handler(0);
+}
+
+//--------------------------------------------------------------------+
+// MACRO TYPEDEF CONSTANT ENUM
+//--------------------------------------------------------------------+
#define LED_PORT GPIOA
#define LED_PIN GPIO_PIN_5
#define LED_STATE_ON 1
@@ -56,8 +66,6 @@ static void all_rcc_clk_enable(void)
void board_init(void)
{
-
-
/* Configure the system clock to 48 MHz */
RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_OscInitTypeDef RCC_OscInitStruct;
diff --git a/hw/bsp/stm32f072disco/stm32f072disco.c b/hw/bsp/stm32f072disco/stm32f072disco.c
index 7128eb4d9..9a3a354ef 100644
--- a/hw/bsp/stm32f072disco/stm32f072disco.c
+++ b/hw/bsp/stm32f072disco/stm32f072disco.c
@@ -25,9 +25,19 @@
*/
#include "../board.h"
-
#include "stm32f0xx_hal.h"
+//--------------------------------------------------------------------+
+// Forward USB interrupt events to TinyUSB IRQ Handler
+//--------------------------------------------------------------------+
+void USB_IRQHandler(void)
+{
+ tud_irq_handler(0);
+}
+
+//--------------------------------------------------------------------+
+// MACRO TYPEDEF CONSTANT ENUM
+//--------------------------------------------------------------------+
#define LED_PORT GPIOC
#define LED_PIN GPIO_PIN_6
#define LED_STATE_ON 1
diff --git a/hw/bsp/stm32f103bluepill/stm32f103bluepill.c b/hw/bsp/stm32f103bluepill/stm32f103bluepill.c
index e68bdd1bf..dbb58032c 100644
--- a/hw/bsp/stm32f103bluepill/stm32f103bluepill.c
+++ b/hw/bsp/stm32f103bluepill/stm32f103bluepill.c
@@ -25,9 +25,29 @@
*/
#include "../board.h"
-
#include "stm32f1xx_hal.h"
+//--------------------------------------------------------------------+
+// Forward USB interrupt events to TinyUSB IRQ Handler
+//--------------------------------------------------------------------+
+void USB_HP_IRQHandler(void)
+{
+ tud_irq_handler(0);
+}
+
+void USB_LP_IRQHandler(void)
+{
+ tud_irq_handler(0);
+}
+
+void USBWakeUp_IRQHandler(void)
+{
+ tud_irq_handler(0);
+}
+
+//--------------------------------------------------------------------+
+// MACRO TYPEDEF CONSTANT ENUM
+//--------------------------------------------------------------------+
#define LED_PORT GPIOC
#define LED_PIN GPIO_PIN_13
#define LED_STATE_ON 0
diff --git a/hw/bsp/stm32f303disco/stm32f303disco.c b/hw/bsp/stm32f303disco/stm32f303disco.c
index 44a342e04..444472a79 100644
--- a/hw/bsp/stm32f303disco/stm32f303disco.c
+++ b/hw/bsp/stm32f303disco/stm32f303disco.c
@@ -25,9 +25,41 @@
*/
#include "../board.h"
-
#include "stm32f3xx_hal.h"
+//--------------------------------------------------------------------+
+// Forward USB interrupt events to TinyUSB IRQ Handler
+//--------------------------------------------------------------------+
+
+// USB defaults to using interrupts 19, 20, and 42 (based on SYSCFG_CFGR1.USB_IT_RMP)
+// FIXME: Do all three need to be handled, or just the LP one?
+// USB high-priority interrupt (Channel 19): Triggered only by a correct
+// transfer event for isochronous and double-buffer bulk transfer to reach
+// the highest possible transfer rate.
+void USB_HP_CAN_TX_IRQHandler(void)
+{
+ tud_irq_handler(0);
+}
+
+// USB low-priority interrupt (Channel 20): Triggered by all USB events
+// (Correct transfer, USB reset, etc.). The firmware has to check the
+// interrupt source before serving the interrupt.
+void USB_LP_CAN_RX0_IRQHandler(void)
+{
+ tud_irq_handler(0);
+}
+
+// USB wakeup interrupt (Channel 42): Triggered by the wakeup event from the USB
+// Suspend mode.
+void USBWakeUp_IRQHandler(void)
+{
+ tud_irq_handler(0);
+}
+
+//--------------------------------------------------------------------+
+// MACRO TYPEDEF CONSTANT ENUM
+//--------------------------------------------------------------------+
+
#define LED_PORT GPIOE
#define LED_PIN GPIO_PIN_9
#define LED_STATE_ON 1
diff --git a/hw/bsp/stm32l0538disco/stm32l0538disco.c b/hw/bsp/stm32l0538disco/stm32l0538disco.c
index 2d9b49951..0bfb1f845 100644
--- a/hw/bsp/stm32l0538disco/stm32l0538disco.c
+++ b/hw/bsp/stm32l0538disco/stm32l0538disco.c
@@ -25,9 +25,19 @@
*/
#include "../board.h"
-
#include "stm32l0xx_hal.h"
+//--------------------------------------------------------------------+
+// Forward USB interrupt events to TinyUSB IRQ Handler
+//--------------------------------------------------------------------+
+void USB_IRQHandler(void)
+{
+ tud_irq_handler(0);
+}
+
+//--------------------------------------------------------------------+
+// MACRO TYPEDEF CONSTANT ENUM
+//--------------------------------------------------------------------+
#define LED_PORT GPIOA
#define LED_PIN GPIO_PIN_5
#define LED_STATE_ON 1