add timer to control interrupt transfer

This commit is contained in:
sakumisu
2024-03-14 19:31:52 +08:00
parent 869b5809f3
commit 2660af5d87
6 changed files with 110 additions and 4 deletions

View File

@@ -43,6 +43,8 @@ extern "C" {
#define CLASS_INFO_DEFINE __attribute__((section("usbh_class_info"))) __USED __ALIGNED(1)
#endif
#define USBH_GET_URB_INTERVAL(interval, speed) (speed < USB_SPEED_HIGH ? interval: (1 << (interval - 1)))
#define USBH_EP_INIT(ep, ep_desc) \
do { \
ep = ep_desc; \
@@ -128,6 +130,7 @@ struct usbh_hub {
struct usb_endpoint_descriptor *intin;
struct usbh_urb intin_urb;
uint8_t *int_buffer;
struct usb_osal_timer *int_timer;
};
struct usbh_devaddr_map {
@@ -214,6 +217,7 @@ static inline void usbh_int_urb_fill(struct usbh_urb *urb,
urb->timeout = timeout;
urb->complete = complete;
urb->arg = arg;
urb->interval = USBH_GET_URB_INTERVAL(ep->bInterval, hport->speed);
}
extern struct usbh_bus g_usbhost_bus[];