diff options
| author | sakumisu <[email protected]> | 2025-01-15 17:10:19 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2025-01-15 17:10:19 +0800 |
| commit | 64394bf246ece73201b7e76092a26d36fa793fb3 (patch) | |
| tree | ca5729d3ddc606831cf8775e3fedbf0e3d95dabb | |
| parent | 1a1b475523b72e7d2282f6d370ae3a3114d32fa8 (diff) | |
update: add USBH_IRQHandler & USBD_IRQHandler function declaration
Signed-off-by: sakumisu <[email protected]>
| -rw-r--r-- | common/usb_dc.h | 5 | ||||
| -rw-r--r-- | common/usb_hc.h | 3 | ||||
| -rw-r--r-- | port/template/usb_dc.c | 16 | ||||
| -rw-r--r-- | port/template/usb_hc.c | 10 |
4 files changed, 12 insertions, 22 deletions
diff --git a/common/usb_dc.h b/common/usb_dc.h index 1f2fdddd..dd85d7cb 100644 --- a/common/usb_dc.h +++ b/common/usb_dc.h @@ -136,7 +136,7 @@ int usbd_ep_start_write(uint8_t busid, const uint8_t ep, const uint8_t *data, ui */ int usbd_ep_start_read(uint8_t busid, const uint8_t ep, uint8_t *data, uint32_t data_len); -/* usb dcd irq callback */ +/* usb dcd irq callback, called by user */ /** * @brief Usb connect irq callback. @@ -194,6 +194,9 @@ void usbd_event_ep_out_complete_handler(uint8_t busid, uint8_t ep, uint32_t nbyt void usbd_execute_test_mode(uint8_t busid, uint8_t test_mode); #endif +/* called by user */ +void USBD_IRQHandler(uint8_t busid); + #ifdef __cplusplus } #endif diff --git a/common/usb_hc.h b/common/usb_hc.h index c4e2a16d..3335af2f 100644 --- a/common/usb_hc.h +++ b/common/usb_hc.h @@ -108,6 +108,9 @@ int usbh_submit_urb(struct usbh_urb *urb); */ int usbh_kill_urb(struct usbh_urb *urb); +/* called by user */ +void USBH_IRQHandler(uint8_t busid); + #ifdef __cplusplus } #endif diff --git a/port/template/usb_dc.c b/port/template/usb_dc.c index 814a42f8..74533701 100644 --- a/port/template/usb_dc.c +++ b/port/template/usb_dc.c @@ -1,13 +1,5 @@ #include "usbd_core.h" -#ifndef USBD_IRQHandler -#define USBD_IRQHandler USBD_IRQHandler -#endif - -#ifndef USB_NUM_BIDIR_ENDPOINTS -#define USB_NUM_BIDIR_ENDPOINTS 5 -#endif - /* Endpoint state */ struct usb_dc_ep_state { uint16_t ep_mps; /* Endpoint max packet size */ @@ -21,8 +13,8 @@ struct usb_dc_ep_state { /* Driver state */ struct xxx_udc { volatile uint8_t dev_addr; - struct usb_dc_ep_state in_ep[USB_NUM_BIDIR_ENDPOINTS]; /*!< IN endpoint parameters*/ - struct usb_dc_ep_state out_ep[USB_NUM_BIDIR_ENDPOINTS]; /*!< OUT endpoint parameters */ + struct usb_dc_ep_state in_ep[CONFIG_USBDEV_EP_NUM]; /*!< IN endpoint parameters*/ + struct usb_dc_ep_state out_ep[CONFIG_USBDEV_EP_NUM]; /*!< OUT endpoint parameters */ } g_xxx_udc; __WEAK void usb_dc_low_level_init(void) @@ -121,6 +113,6 @@ int usbd_ep_start_read(uint8_t busid, const uint8_t ep, uint8_t *data, uint32_t return 0; } -void USBD_IRQHandler(void) +void USBD_IRQHandler(uint8_t busid) { -} +}
\ No newline at end of file diff --git a/port/template/usb_hc.c b/port/template/usb_hc.c index c8258582..9955636b 100644 --- a/port/template/usb_hc.c +++ b/port/template/usb_hc.c @@ -7,14 +7,6 @@ #include "usbh_hub.h" #include "usb_xxx_reg.h" -#ifndef USBH_IRQHandler -#define USBH_IRQHandler OTG_HS_IRQHandler -#endif - -#ifndef USB_BASE -#define USB_BASE (0x40040000UL) -#endif - struct dwc2_pipe { bool inuse; uint32_t xfrd; @@ -300,6 +292,6 @@ static inline void dwc2_urb_waitup(struct usbh_urb *urb) } } -void USBH_IRQHandler(void) +void USBH_IRQHandler(uint8_t busid) { }
\ No newline at end of file |
