mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-16 05:42:56 +00:00
move irq for stm32 fsdev
This commit is contained in:
parent
fc9170b2c1
commit
9014ca5528
@ -43,10 +43,9 @@ void USBD_IRQHandler(void)
|
|||||||
tud_irq_handler(0);
|
tud_irq_handler(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
/*------------------------------------------------------------------*/
|
// MACRO TYPEDEF CONSTANT ENUM
|
||||||
/* MACRO TYPEDEF CONSTANT ENUM
|
//--------------------------------------------------------------------+
|
||||||
*------------------------------------------------------------------*/
|
|
||||||
#define _PINNUM(port, pin) ((port)*32 + (pin))
|
#define _PINNUM(port, pin) ((port)*32 + (pin))
|
||||||
|
|
||||||
#define LED_PIN _PINNUM(1, 1)
|
#define LED_PIN _PINNUM(1, 1)
|
||||||
|
@ -25,9 +25,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../board.h"
|
#include "../board.h"
|
||||||
|
|
||||||
#include "stm32f0xx_hal.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_PORT GPIOA
|
||||||
#define LED_PIN GPIO_PIN_5
|
#define LED_PIN GPIO_PIN_5
|
||||||
#define LED_STATE_ON 1
|
#define LED_STATE_ON 1
|
||||||
@ -56,8 +66,6 @@ static void all_rcc_clk_enable(void)
|
|||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/* Configure the system clock to 48 MHz */
|
/* Configure the system clock to 48 MHz */
|
||||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||||
|
@ -25,9 +25,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../board.h"
|
#include "../board.h"
|
||||||
|
|
||||||
#include "stm32f0xx_hal.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_PORT GPIOC
|
||||||
#define LED_PIN GPIO_PIN_6
|
#define LED_PIN GPIO_PIN_6
|
||||||
#define LED_STATE_ON 1
|
#define LED_STATE_ON 1
|
||||||
|
@ -25,9 +25,29 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../board.h"
|
#include "../board.h"
|
||||||
|
|
||||||
#include "stm32f1xx_hal.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_PORT GPIOC
|
||||||
#define LED_PIN GPIO_PIN_13
|
#define LED_PIN GPIO_PIN_13
|
||||||
#define LED_STATE_ON 0
|
#define LED_STATE_ON 0
|
||||||
|
@ -25,9 +25,41 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../board.h"
|
#include "../board.h"
|
||||||
|
|
||||||
#include "stm32f3xx_hal.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_PORT GPIOE
|
||||||
#define LED_PIN GPIO_PIN_9
|
#define LED_PIN GPIO_PIN_9
|
||||||
#define LED_STATE_ON 1
|
#define LED_STATE_ON 1
|
||||||
|
@ -25,9 +25,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../board.h"
|
#include "../board.h"
|
||||||
|
|
||||||
#include "stm32l0xx_hal.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_PORT GPIOA
|
||||||
#define LED_PIN GPIO_PIN_5
|
#define LED_PIN GPIO_PIN_5
|
||||||
#define LED_STATE_ON 1
|
#define LED_STATE_ON 1
|
||||||
|
@ -489,7 +489,9 @@ static void dcd_ep_ctr_handler(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dcd_fs_irqHandler(void) {
|
void dcd_irq_handler(uint8_t rhport) {
|
||||||
|
|
||||||
|
(void) rhport;
|
||||||
|
|
||||||
uint32_t int_status = USB->ISTR;
|
uint32_t int_status = USB->ISTR;
|
||||||
//const uint32_t handled_ints = USB_ISTR_CTR | USB_ISTR_RESET | USB_ISTR_WKUP
|
//const uint32_t handled_ints = USB_ISTR_CTR | USB_ISTR_RESET | USB_ISTR_WKUP
|
||||||
@ -804,57 +806,5 @@ static bool dcd_read_packet_memory(void *__restrict dst, uint16_t src, size_t wN
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Interrupt handlers
|
|
||||||
#if CFG_TUSB_MCU == OPT_MCU_STM32F0 || CFG_TUSB_MCU == OPT_MCU_STM32L0
|
|
||||||
void USB_IRQHandler(void)
|
|
||||||
{
|
|
||||||
dcd_fs_irqHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32F1
|
|
||||||
void USB_HP_IRQHandler(void)
|
|
||||||
{
|
|
||||||
dcd_fs_irqHandler();
|
|
||||||
}
|
|
||||||
void USB_LP_IRQHandler(void)
|
|
||||||
{
|
|
||||||
dcd_fs_irqHandler();
|
|
||||||
}
|
|
||||||
void USBWakeUp_IRQHandler(void)
|
|
||||||
{
|
|
||||||
dcd_fs_irqHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif (CFG_TUSB_MCU) == (OPT_MCU_STM32F3)
|
|
||||||
// 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)
|
|
||||||
{
|
|
||||||
dcd_fs_irqHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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)
|
|
||||||
{
|
|
||||||
dcd_fs_irqHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
// USB wakeup interrupt (Channel 42): Triggered by the wakeup event from the USB
|
|
||||||
// Suspend mode.
|
|
||||||
void USBWakeUp_IRQHandler(void)
|
|
||||||
{
|
|
||||||
dcd_fs_irqHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
#error Which IRQ handler do you need?
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user