update(port/ch32): update irqhandler name

Signed-off-by: sakumisu <1203593632@qq.com>
This commit is contained in:
sakumisu
2025-05-07 22:07:22 +08:00
parent bf2ba7324a
commit 6516a470c8
4 changed files with 32 additions and 28 deletions

View File

@@ -7,10 +7,6 @@
#define USB_BASE 0x40009000u #define USB_BASE 0x40009000u
#define CH585_USBHS_DEV ((USBHSD_TypeDef *)USB_BASE) #define CH585_USBHS_DEV ((USBHSD_TypeDef *)USB_BASE)
#ifndef USBD_IRQHandler
#define USBD_IRQHandler USB2_DEVICE_IRQHandler //use actual usb irq name instead
#endif
#define R16_PIN_CONFIG (*((PUINT16V)0x4000101A)) #define R16_PIN_CONFIG (*((PUINT16V)0x4000101A))
#define R32_PIN_CONFIG (*((PUINT32V)0x40001018)) // RW, I/O pin configuration #define R32_PIN_CONFIG (*((PUINT32V)0x40001018)) // RW, I/O pin configuration
#define RB_PIN_USB2_EN 0x20 #define RB_PIN_USB2_EN 0x20
@@ -493,9 +489,7 @@ static inline void usb_trans_end_process(void)
* @param[in] None * @param[in] None
* @retval None * @retval None
*/ */
__attribute__((interrupt("WCH-Interrupt-fast"))) void USBD_IRQHandler(uint8_t busid)
__attribute__((section(".highcode"))) void
USBD_IRQHandler(void)
{ {
volatile uint8_t intflag = 0; volatile uint8_t intflag = 0;
intflag = CH585_USBHS_DEV->INT_FG; intflag = CH585_USBHS_DEV->INT_FG;
@@ -523,3 +517,10 @@ USBD_IRQHandler(void)
CH585_USBHS_DEV->INT_FG = intflag; CH585_USBHS_DEV->INT_FG = intflag;
} }
} }
void USB2_DEVICE_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast"))) __attribute__((section(".highcode")));
void USB2_DEVICE_IRQHandler(void)
{
extern void USBD_IRQHandler(uint8_t busid);
USBD_IRQHandler(0);
}

View File

@@ -17,10 +17,6 @@
#endif #endif
#define CH58x_USBFS_DEV ((USB_FS_TypeDef *)USBD) #define CH58x_USBFS_DEV ((USB_FS_TypeDef *)USBD)
#ifndef USBD_IRQHandler
#define USBD_IRQHandler USB_IRQHandler //use actual usb irq name instead
#endif
/*!< 8-bit value of endpoint control register */ /*!< 8-bit value of endpoint control register */
#define EPn_CTRL(epid) \ #define EPn_CTRL(epid) \
*(volatile uint8_t *)(&(CH58x_USBFS_DEV->UEP0_CTRL) + epid * 4 + (epid / 5) * 48) *(volatile uint8_t *)(&(CH58x_USBFS_DEV->UEP0_CTRL) + epid * 4 + (epid / 5) * 48)
@@ -456,9 +452,7 @@ int usbd_ep_start_read(uint8_t busid, const uint8_t ep, uint8_t *data, uint32_t
* @param[in] None * @param[in] None
* @retval None * @retval None
*/ */
__attribute__((interrupt("WCH-Interrupt-fast"))) void USBD_IRQHandler(uint8_t busid)
__attribute__((section(".highcode"))) void
USBD_IRQHandler(void)
{ {
volatile uint8_t intflag = 0; volatile uint8_t intflag = 0;
intflag = CH58x_USBFS_DEV->USB_INT_FG; intflag = CH58x_USBFS_DEV->USB_INT_FG;
@@ -637,3 +631,10 @@ USBD_IRQHandler(void)
CH58x_USBFS_DEV->USB_INT_FG = intflag; CH58x_USBFS_DEV->USB_INT_FG = intflag;
} }
} }
void USB_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast"))) __attribute__((section(".highcode")));
void USB_IRQHandler(void)
{
extern void USBD_IRQHandler(uint8_t busid);
USBD_IRQHandler(0);
}

View File

@@ -10,10 +10,6 @@
#error "usb fs do not support hs" #error "usb fs do not support hs"
#endif #endif
#ifndef USBD_IRQHandler
#define USBD_IRQHandler OTG_FS_IRQHandler //use actual usb irq name instead
#endif
#ifndef USB_NUM_BIDIR_ENDPOINTS #ifndef USB_NUM_BIDIR_ENDPOINTS
#define USB_NUM_BIDIR_ENDPOINTS 8 #define USB_NUM_BIDIR_ENDPOINTS 8
#endif #endif
@@ -49,8 +45,6 @@ struct ch32_usbfs_udc {
volatile bool ep0_rx_data_toggle; volatile bool ep0_rx_data_toggle;
volatile bool ep0_tx_data_toggle; volatile bool ep0_tx_data_toggle;
void USBD_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
__WEAK void usb_dc_low_level_init(void) __WEAK void usb_dc_low_level_init(void)
{ {
} }
@@ -262,7 +256,7 @@ int usbd_ep_start_read(uint8_t busid, const uint8_t ep, uint8_t *data, uint32_t
return 0; return 0;
} }
void USBD_IRQHandler(void) void USBD_IRQHandler(uint8_t busid)
{ {
uint32_t ep_idx = 0, token, write_count, read_count; uint32_t ep_idx = 0, token, write_count, read_count;
uint8_t intflag = 0; uint8_t intflag = 0;
@@ -407,3 +401,10 @@ void USBD_IRQHandler(void)
USBFS_DEVICE->INT_FG = intflag; USBFS_DEVICE->INT_FG = intflag;
} }
} }
void OTG_FS_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
void OTG_FS_IRQHandler(void)
{
extern void USBD_IRQHandler(uint8_t busid);
USBD_IRQHandler(0);
}

View File

@@ -6,10 +6,6 @@
#include "usbd_core.h" #include "usbd_core.h"
#include "usb_ch32_usbhs_reg.h" #include "usb_ch32_usbhs_reg.h"
#ifndef USBD_IRQHandler
#define USBD_IRQHandler USBHS_IRQHandler //use actual usb irq name instead
#endif
#ifndef USB_NUM_BIDIR_ENDPOINTS #ifndef USB_NUM_BIDIR_ENDPOINTS
#define USB_NUM_BIDIR_ENDPOINTS 16 #define USB_NUM_BIDIR_ENDPOINTS 16
#endif #endif
@@ -43,8 +39,6 @@ struct ch32_usbhs_udc {
struct ch32_usbhs_ep_state out_ep[USB_NUM_BIDIR_ENDPOINTS]; /*!< OUT endpoint parameters */ struct ch32_usbhs_ep_state out_ep[USB_NUM_BIDIR_ENDPOINTS]; /*!< OUT endpoint parameters */
} g_ch32_usbhs_udc; } g_ch32_usbhs_udc;
void USBHS_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
volatile uint8_t mps_over_flag = 0; volatile uint8_t mps_over_flag = 0;
volatile bool ep0_rx_data_toggle; volatile bool ep0_rx_data_toggle;
volatile bool ep0_tx_data_toggle; volatile bool ep0_tx_data_toggle;
@@ -255,7 +249,7 @@ int usbd_ep_start_read(uint8_t busid, const uint8_t ep, uint8_t *data, uint32_t
return 0; return 0;
} }
void USBD_IRQHandler(void) void USBD_IRQHandler(uint8_t busid)
{ {
uint32_t ep_idx, token, write_count, read_count; uint32_t ep_idx, token, write_count, read_count;
uint8_t intflag = 0; uint8_t intflag = 0;
@@ -385,3 +379,10 @@ void USBD_IRQHandler(void)
USBHS_DEVICE->INT_FG = USBHS_DETECT_FLAG; USBHS_DEVICE->INT_FG = USBHS_DETECT_FLAG;
} }
} }
void USBHS_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
void USBHS_IRQHandler(void)
{
extern void USBD_IRQHandler(uint8_t busid);
USBD_IRQHandler(0);
}