diff options
| author | sakumisu <[email protected]> | 2021-12-05 20:37:11 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2021-12-05 21:00:22 +0800 |
| commit | 574b79b9ea969eb724db2a8a645ed050f9bbc5c3 (patch) | |
| tree | 3a54a279490e8727d8e562183ed9af5208d50e87 | |
| parent | 641be186bad9fc3146a407ee190c049f499afe8e (diff) | |
add default usb irq name for USBD_IRQHandler
| -rw-r--r-- | port/fsdev/usb_dc_fsdev.c | 2 | ||||
| -rw-r--r-- | port/mm32/usb_dc.c | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/port/fsdev/usb_dc_fsdev.c b/port/fsdev/usb_dc_fsdev.c index 2be7688b..ffdbc620 100644 --- a/port/fsdev/usb_dc_fsdev.c +++ b/port/fsdev/usb_dc_fsdev.c @@ -1,7 +1,9 @@ #include "usbd_core.h" #include "usb_fsdev_regs.h" +#ifndef USBD_IRQHandler #define USBD_IRQHandler USB_LP_CAN1_RX0_IRQHandler //use actual usb irq name instead +#endif #ifndef USB_NUM_BIDIR_ENDPOINTS #define USB_NUM_BIDIR_ENDPOINTS 8 diff --git a/port/mm32/usb_dc.c b/port/mm32/usb_dc.c index a24dcce9..9821d6e7 100644 --- a/port/mm32/usb_dc.c +++ b/port/mm32/usb_dc.c @@ -10,6 +10,10 @@ #define USB_GET_EP_FIFO(ep_idx) (*(volatile uint32_t *)(&USB->rEP0_FIFO + ep_idx)) #define USB_SET_EP_FIFO(ep_idx, val) (*(volatile uint32_t *)(&USB->rEP0_FIFO + ep_idx) = val) +#ifndef USBD_IRQHandler +#define USBD_IRQHandler USB_HP_CAN1_TX_IRQHandler //use actual usb irq name instead +#endif + #ifndef USB_NUM_BIDIR_ENDPOINTS #define USB_NUM_BIDIR_ENDPOINTS 5 #endif @@ -121,13 +125,12 @@ int usbd_ep_close(const uint8_t ep) int usbd_ep_set_stall(const uint8_t ep) { - while (USB->rEP0_CTRL & 0x80) - ; - USB->rEP_HALT = (1 << (ep & 0x7f)); + USB->rEP_HALT |= (1 << (ep & 0x7f)); return 0; } int usbd_ep_clear_stall(const uint8_t ep) { + USB->rEP_HALT &= ~(1 << (ep & 0x7f)); return 0; } int usbd_ep_is_stalled(const uint8_t ep, uint8_t *stalled) @@ -208,7 +211,7 @@ int usbd_ep_read(const uint8_t ep, uint8_t *data, uint32_t max_data_len, uint32_ * @param hpcd PCD handle * @retval HAL status */ -void USB_HP_CAN1_TX_IRQHandler(void) +void USBD_IRQHandler(void) { uint32_t int_status; uint32_t epindex; |
