diff options
| author | sakumisu <[email protected]> | 2026-12-05 21:53:00 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2026-12-05 21:53:00 +0800 |
| commit | 5255bc6b8379d6b35d256284675e30fb3fc8ea07 (patch) | |
| tree | 3271448c80d911a4d1ae995dca9352eff8ad2fe0 | |
| parent | aee56670892c2bfef76fa5f6fcc5bdfa52fe712a (diff) | |
Signed-off-by: sakumisu <[email protected]>
| -rw-r--r-- | common/usb_hc.h | 2 | ||||
| -rw-r--r-- | common/usb_list.h | 6 | ||||
| -rw-r--r-- | core/usbh_core.h | 20 |
3 files changed, 15 insertions, 13 deletions
diff --git a/common/usb_hc.h b/common/usb_hc.h index 9e96474e..1e5efd83 100644 --- a/common/usb_hc.h +++ b/common/usb_hc.h @@ -35,7 +35,7 @@ struct usbh_iso_frame_packet { * Structure containing the USB Urb configuration. */ struct usbh_urb { - usb_slist_t list; + usb_dlist_t list; void *hcpriv; struct usbh_hubport *hport; struct usbh_endpoint *ep; diff --git a/common/usb_list.h b/common/usb_list.h index 3078a1f2..1cd52f44 100644 --- a/common/usb_list.h +++ b/common/usb_list.h @@ -204,9 +204,9 @@ static inline int usb_slist_isempty(usb_slist_t *l) #define usb_slist_for_each(pos, head) \ for (pos = (head)->next; pos != NULL; pos = pos->next) -#define usb_slist_for_each_safe(pos, next, head) \ - for (pos = (head)->next, next = pos->next; pos; \ - pos = next, next = pos->next) +#define usb_slist_for_each_safe(pos, n, head) \ + for (pos = (head)->next, n = pos ? pos->next : NULL; pos; \ + pos = n, n = pos ? pos->next : NULL) /** * usb_slist_for_each_entry - iterate over single list of given type diff --git a/core/usbh_core.h b/core/usbh_core.h index cf7b16d2..d969a61c 100644 --- a/core/usbh_core.h +++ b/core/usbh_core.h @@ -84,15 +84,16 @@ enum usbh_event_type { #define USBH_GET_URB_INTERVAL(interval, speed) (speed < USB_SPEED_HIGH ? (interval * 1000) : ((1 << (interval - 1)) * 125)) -#define USBH_EP_INIT(ep, endpoint) \ - do { \ - (ep) = (endpoint); \ - USB_LOG_INFO("Ep=%02x Attr=%02u Mps=%d Interval=%02u Mult=%02u\r\n", \ - (ep)->ep_desc.bEndpointAddress, \ - (ep)->ep_desc.bmAttributes, \ - USB_GET_MAXPACKETSIZE((ep)->ep_desc.wMaxPacketSize), \ - (ep)->ep_desc.bInterval, \ - USB_GET_MULT((ep)->ep_desc.wMaxPacketSize)); \ +#define USBH_EP_INIT(ep, endpoint) \ + do { \ + (ep) = (endpoint); \ + usb_dlist_init(&(ep)->urb_list); \ + USB_LOG_INFO("Ep=%02x Attr=%02u Mps=%d Interval=%02u Mult=%02u\r\n", \ + (ep)->ep_desc.bEndpointAddress, \ + (ep)->ep_desc.bmAttributes, \ + USB_GET_MAXPACKETSIZE((ep)->ep_desc.wMaxPacketSize), \ + (ep)->ep_desc.bInterval, \ + USB_GET_MULT((ep)->ep_desc.wMaxPacketSize)); \ } while (0) typedef void (*usbh_event_handler_t)(uint8_t busid, uint8_t hub_index, uint8_t hub_port, uint8_t intf, uint8_t event); @@ -117,6 +118,7 @@ struct usbh_class_driver { struct usbh_endpoint { struct usb_endpoint_descriptor ep_desc; + usb_dlist_t urb_list; }; struct usbh_interface_altsetting { |
